Skip to content

Instantly share code, notes, and snippets.

@neo-32
Created April 7, 2018 03:47
Show Gist options
  • Save neo-32/3c0285d9d67db0c44a81b79bb3a844b5 to your computer and use it in GitHub Desktop.
Save neo-32/3c0285d9d67db0c44a81b79bb3a844b5 to your computer and use it in GitHub Desktop.
import telnetlib
import re
import binascii
import time
tn = telnetlib.Telnet('hosthere',23)
xstring = tn.read_until('string')
binstring = re.search('of ([0|1]+)',xstring).group(1)
number = int(binstring,2)
result = binascii.unhexlify('%x' % number)
tn.write(result)
print result
tn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment