Skip to content

Commit

Permalink
Add support for Python 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSobky committed Oct 12, 2022
1 parent b719c2a commit b046683
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions AutoRecon.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Automate the reconnaissance process of web hacking.
Automate the reconnaissance process, given a domain name.
"""
from __future__ import absolute_import, print_function
import sys
import socket
import subprocess
Expand All @@ -14,10 +15,10 @@ def main():
domain = sys.argv[1]
ip_address = socket.gethostbyname(domain)
except IndexError:
print 'Error: Domain name not specified.'
print('Error: Domain name not specified.')
sys.exit(1)
except socket.gaierror:
print 'Error: Domain name cannot be resolved.'
print('Error: Domain name cannot be resolved.')
raise
procs = []
whois_cmd = ['whois', domain]
Expand All @@ -38,11 +39,11 @@ def main():
def handle_proc(proc):
"""Handle subprocesses outputs."""
separator = '=================='
output = ''.join(proc.stdout.readlines())
print proc.title
print separator
print output.strip()
print separator + '\n'
output = b''.join(proc.stdout.readlines()).decode('utf-8')
print(proc.title)
print(separator)
print(output.strip())
print(separator + '\n')
procs.remove(proc)

for title, cmd in cmds.items():
Expand All @@ -51,7 +52,7 @@ def handle_proc(proc):
proc.title = title
procs.append(proc)
except OSError:
print '%s >> Dependency error occurred.\n' % title
print('%s >> Dependency error occurred.\n' % title)

while True:
for proc in procs:
Expand All @@ -60,11 +61,11 @@ def handle_proc(proc):
handle_proc(proc)
else:
continue
if len(procs) == 0:
if not procs:
break
else:
sleep(1)

if __name__ == '__main__':
print 'This is gonna take quite a while; you better go make some coffee!\n'
print('This is gonna take quite a while; you better go make some coffee!\n')
main()

0 comments on commit b046683

Please sign in to comment.