Skip to content

Instantly share code, notes, and snippets.

@intrd
Last active October 20, 2023 01:46
Show Gist options
  • Select an option

  • Save intrd/f10d32003bfb157dac7f89fde886abea to your computer and use it in GitHub Desktop.

Select an option

Save intrd/f10d32003bfb157dac7f89fde886abea to your computer and use it in GitHub Desktop.
Math bot script - prog100-math_bot @ alexctf 2017
#!/usr/bin/python
## Math bot script - prog100-math_bot @ alexctf 2017
# @author intrd - http://dann.com.br/ (original script here: http://crypto.stackexchange.com/questions/19444/rsa-given-q-p-and-e)
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
# int_netcat.py - https://gist.github.com/intrd/00a39c83f752acf81775bfa9721e745a
import re, sys, string, time
sys.path.append("../../LIBS/")
from int_netcat import Netcat
nc = Netcat('195.154.53.62', 1337)
while 1:
data=nc.read()
print(data)
if "Question" not in data:
exit()
n1=re.search(r"(.*) =", data).group(1).split("=")[0]
n1 = eval(n1)
print str(n1).strip()
nc.write(str(n1) + '\n')
#time.sleep(1)
nc.close()
@pewhardtokill
Copy link

#!/usr/bin/python

Math bot script - prog100-math_bot @ alexctf 2017

@author intrd - http://dann.com.br/ (original script here: http://crypto.stackexchange.com/questions/19444/rsa-given-q-p-and-e)

@license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/

int_netcat.py - https://gist.github.com/intrd/00a39c83f752acf81775bfa9721e745a

import re, sys, string, time
sys.path.append("../../LIBS/")
from int_netcat import Netcat

nc = Netcat('195.154.53.62', 1337)

while 1:
data=nc.read()
print(data)
if "Question" not in data:
exit()

n1=re.search(r"(.*) =", data).group(1).split("=")[0]
n1 = eval(n1)
print str(n1).strip()

nc.write(str(n1) + '\n')
#time.sleep(1)

nc.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment