Skip to content

Commit

Permalink
Fix saving file bug
Browse files Browse the repository at this point in the history
  • Loading branch information
k4m4 committed Nov 29, 2017
1 parent 764467c commit d54bf41
Showing 1 changed file with 2 additions and 45 deletions.
47 changes: 2 additions & 45 deletions onioff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
See License at nikolaskama.me (https://nikolaskama.me/onioffproject)
"""

import socket, socks, requests, sys, os, optparse, time, httplib, datetime, re, multiprocessing
import socket, socks, requests, sys, os, optparse, time, httplib, datetime, re
from termcolor import colored
from bs4 import BeautifulSoup
from time import sleep
Expand Down Expand Up @@ -164,25 +164,6 @@ def readFile(file): # Read Onion File
if not onion.startswith('http') and not onion.startswith('https'):
onion = 'http://'+str(onion)
checkOnion(onion)
# try:
# p = multiprocessing.Process(target=checkOnion, name="checkOnion", args=(onion,))
# p.start()
# p.join(int(options.max))
# if p.is_alive():
# global response
# if not 'response' in globals():
# p.terminate()
# response = 'INACTIVE (Took Too Long)'
# response2 = 'UNAVAILABLE (Onion Inactive)'
# gathered[onion] = response, response2
# flushPrint("\n[-] Onion Took Too Long to Respond --> ASSUMED INACTIVE", True, True)
# pass
# except KeyboardInterrupt:
# if p.is_alive():
# p.terminate()
# p.join()
# print '\nHave A Great Day! :)'
# sys.exit(1)

else:
flushPrint("\n[-] Dictionary Is Empty --> Please Enter A Valid File", True, True)
Expand Down Expand Up @@ -233,35 +214,13 @@ def main():
flushPrint("\n[-] System Exit\n", True)
sys.exit(1)

global outFile
outFile = uniqueOutFile(options.output_file)

for onion in argv:
if not onion.startswith('http') and not onion.startswith('https'):
flushPrint("\n[-] No Onion URL Found --> Please Enter A Valid URL", True, True)
flushPrint("\n[-] System Exit\n", True)
sys.exit(1)
else:
checkOnion(onion)
# try:
# p = multiprocessing.Process(target=checkOnion, name="checkOnion", args=(onion,))
# p.start()
# p.join(int(options.max))
# if p.is_alive():
# global response
# if not 'response' in globals():
# p.terminate()
# response = 'INACTIVE (Took Too Long)'
# response2 = 'UNAVAILABLE (Onion Inactive)'
# gathered[onion] = response, response2
# flushPrint("\n[-] Onion Took Too Long to Respond --> ASSUMED INACTIVE", True, True)
# pass
# except KeyboardInterrupt:
# if p.is_alive():
# p.terminate()
# p.join()
# print '\nHave A Great Day! :)'
# sys.exit(1)

if options.file != None:
file = options.file
Expand All @@ -272,6 +231,7 @@ def main():
sys.exit(1)

try:
outFile = uniqueOutFile(options.output_file)
with open(outFile, 'a') as OutFile:
for k, v in gathered.items():
# output format {some_link.onion} - {page_title}
Expand Down Expand Up @@ -319,9 +279,6 @@ def main():
parser.add_option('-o', '--output', action='store', default=default,
dest='output_file', help='output filename')

# parser.add_option('-m', '--max', action='store', default=40,
# dest='max', help='maximum number of seconds to wait for each response (default: 40)')

parser.add_option('-F', '--fast', action='store_true', default=False,
dest='fast', help='finish investigation asap')

Expand Down

0 comments on commit d54bf41

Please sign in to comment.