mirror of
https://github.com/laramies/theHarvester.git
synced 2024-09-22 16:26:34 +08:00
Added check to verify existence of output directory and pep8 fixes.
This commit is contained in:
parent
4b04c70beb
commit
5ee07edb3f
|
@ -593,6 +593,9 @@ async def handler(lst):
|
||||||
from aiomultiprocess import Pool
|
from aiomultiprocess import Pool
|
||||||
from theHarvester.screenshot.screenshot import ScreenShotter
|
from theHarvester.screenshot.screenshot import ScreenShotter
|
||||||
screen_shotter = ScreenShotter(args.screenshot)
|
screen_shotter = ScreenShotter(args.screenshot)
|
||||||
|
path_exists = screen_shotter.verify_path()
|
||||||
|
# Verify path exists if not create it or if user does not create it skip screenshot
|
||||||
|
if path_exists:
|
||||||
await screen_shotter.verify_installation()
|
await screen_shotter.verify_installation()
|
||||||
print(f'Screenshots can be found: {screen_shotter.output}{screen_shotter.slash}')
|
print(f'Screenshots can be found: {screen_shotter.output}{screen_shotter.slash}')
|
||||||
start = time.perf_counter()
|
start = time.perf_counter()
|
||||||
|
@ -615,7 +618,12 @@ async def handler(lst):
|
||||||
except Exception as ee:
|
except Exception as ee:
|
||||||
print(f'An exception has occurred while mapping: {ee}')
|
print(f'An exception has occurred while mapping: {ee}')
|
||||||
end = time.perf_counter()
|
end = time.perf_counter()
|
||||||
print(f"Finished taking screenshots in {end - start} seconds")
|
# There is probably an easier way to do this
|
||||||
|
total = end - start
|
||||||
|
mon, sec = divmod(total, 60)
|
||||||
|
hr, mon = divmod(mon, 60)
|
||||||
|
total_time = "%02d:%02d" % (mon, sec)
|
||||||
|
print(f"Finished taking screenshots in {total_time} seconds")
|
||||||
print('[+] Note there may be leftover chrome processes you may have to kill manually\n')
|
print('[+] Note there may be leftover chrome processes you may have to kill manually\n')
|
||||||
|
|
||||||
# Shodan
|
# Shodan
|
||||||
|
|
|
@ -303,7 +303,6 @@ async def generatescreenshots(tups: List):
|
||||||
<p> </p>
|
<p> </p>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
'''
|
'''
|
||||||
|
|
||||||
base = 'var tabledata = [ '
|
base = 'var tabledata = [ '
|
||||||
for tup in tups:
|
for tup in tups:
|
||||||
date = tup[0]
|
date = tup[0]
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import asyncio
|
import asyncio
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,19 @@ def __init__(self, output):
|
||||||
self.slash = "\\" if 'win' in sys.platform else '/'
|
self.slash = "\\" if 'win' in sys.platform else '/'
|
||||||
self.slash = "" if (self.output[-1] == "\\" or self.output[-1] == "/") else self.slash
|
self.slash = "" if (self.output[-1] == "\\" or self.output[-1] == "/") else self.slash
|
||||||
|
|
||||||
|
def verify_path(self):
|
||||||
|
try:
|
||||||
|
if not os.path.isdir(self.output):
|
||||||
|
answer = input(f'[+] The output path you have entered does not exist would you like to create it (y/n): ')
|
||||||
|
if answer.lower() == 'yes' or answer.lower() == 'y':
|
||||||
|
os.mkdir(self.output)
|
||||||
|
return True
|
||||||
|
print('path is a directory')
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An exception has occurred while attempting to verify output path's existence: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def verify_installation():
|
async def verify_installation():
|
||||||
# Helper function that verifies pyppeteer & chromium are installed
|
# Helper function that verifies pyppeteer & chromium are installed
|
||||||
|
|
Loading…
Reference in a new issue