Skip to content

Commit

Permalink
Added Eth&BC Donation options, Minor Fix to encoding issues. Minor up…
Browse files Browse the repository at this point in the history
…date to help menu to make more verbouse.

Signed-off-by: novacygni <novacygni@hotmail.co.uk>
  • Loading branch information
NovaCygni committed Mar 2, 2018
1 parent 129c6ce commit f8854c6
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 105 deletions.
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -25,5 +25,5 @@
package_dir={'v3n0m': 'src'},
packages=['v3n0m'], install_requires=['aiohttp', 'httplib2', 'socksipy-branch', 'requests', 'url', 'bs4',
'pip', 'dnspython', 'tqdm', 'aioftp', 'termcolor', 'aio_ping', 'async_timeout'])
except Exception:
print(Exception)
except Exception as verb:
print(str(verb))
1 change: 0 additions & 1 deletion src/lfisuite.py
Expand Up @@ -127,7 +127,6 @@ def checkIfWindows(path):

# noinspection PyPep8
def banner():
os.system('cls' if os.name == 'nt' else 'clear')
print("""
.//// *, ,//// *,
Expand Down
139 changes: 56 additions & 83 deletions src/modules/toxin.py
Expand Up @@ -166,72 +166,31 @@ def checkIP(self, ip):
return False


async def ping(hostname, verbose=False, handle_signals=False, **kw):
"""
Send @count ping to @hostname with the given @timeout
"""
global IPList
global IPList_Holder
global amount_of_addresses_generated
ping = (VerbosePing if verbose else Ping)(verbose=verbose, **kw)
if handle_signals: ping.add_signal_handler()
await ping.init(hostname)
try:
res = await ping.looped()
ping.close()
return res
#Passing the AttributeError to Return False, not sure why I need this but otherwise
#It throws a error about "self.stats doesnt have a attribute pktsRcvd"
except(AttributeError):
amount_of_addresses_generated -= 1
res = False
return res



global IPList
global IPList_Holder
global amount_of_addresses_generated

async def makeips(amount):
global usearch
c = IPChecker()
def makeips(amount):
IPList = []
IPList_Holder = []
c = IPChecker()
# Path to Honeypot file with IP's and Ranges that should NOT be generated. Only a retard wouldnt do this!
c.loadIPs("lists/honeypot_ranges.txt")
total_requested_addresses = int(amount)
tenths_of_requested_addresses = int(total_requested_addresses / 10)
amount_of_addresses_generated = 0
while amount_of_addresses_generated <= total_requested_addresses:
for i in range(0, tenths_of_requested_addresses):
ip = c.generateValidIP()
try:
assert (c.checkIP(ip) == False)
amount_of_addresses_generated += 1
IPList_Holder.append(ip)
except:
print(ip + " Failed to generate")
amount_of_addresses_generated -= 1
raise
futures = []
for p in range(0, tenths_of_requested_addresses):
loop = asyncio.get_event_loop()
for hostname in IPList_Holder:
tasks = [loop.create_task(ping(hostname, False, count=1, timeout=1.35))]
futures.append(loop.run_in_executor(None, ping(tasks)))
#todo - Code to be continued and expanded here.

print("Ips Generated That are online: " + str(len(IPList) - tenths_of_requested_addresses))
amt = int(amount)
for i in range(0, amt):
ip = c.generateValidIP()
try:
assert (c.checkIP(ip) == False)
except:
print(ip + " Failed to generate")
raise
IPList.append(ip)
print("Ips Generated: " + str(len(IPList)))
print("[1] Save IP addresses to file")
print("[2] Print IP addresses")
print("[3] Return to Toxins Menu")
print("[4] Setup Port specific attacks")
print("[0] Exit Toxin Module")
# Create a secondry Log file for working with without corrupting main IP List.
log = "IPLogList.txt"
logfile = open(log, "a")
for t in IPList:
logfile.write(t + "\n")
logfile.write("ftp://" + t + ":21" + "\n")
logfile.close()
chce = input("Option: ")
if chce == '1':
Expand All @@ -248,7 +207,7 @@ async def makeips(amount):
except:
print("Failed to save")
if chce == '2':
pp = pprint.PrettyPrinter(width=70, compact=True)
pp = pprint.PrettyPrinter(width=66, compact=True)
pp.pprint(IPList)
print("Do you wish to start Toxin again or Exit to V3n0M")
print("[1] Stay within Toxin")
Expand All @@ -265,8 +224,10 @@ async def makeips(amount):
print("[0] Exit")
choice = input("Which Option:")
if choice == '1':
in_a_loop = asyncio.get_event_loop()
in_a_loop.run_until_complete(main(in_a_loop))
number = 250
loop = asyncio.get_event_loop()
future = asyncio.ensure_future(run(number))
loop.run_until_complete(future)
if choice == '0':
exit()
if chce == '0':
Expand All @@ -275,6 +236,8 @@ async def makeips(amount):

class CoroutineLimiter:
"""
Inspired by twisted.internet.defer.DeferredSemaphore
If `invoke_as_tasks` is true, wrap the invoked coroutines in Task
objects. This will ensure ensure that the coroutines happen in the
same order `.invoke()` was called, if the tasks are given
Expand Down Expand Up @@ -314,38 +277,48 @@ async def _invoke(self, coro_callable, *args):
self._sem.release()



async def download_coroutine(session, url):
with async_timeout.timeout(3):
async with session.get(url) as response:
filename = os.path.basename(url)
with open(filename, 'wb') as f_handle:
while True:
chunk = await response.content.read(1024)
if not chunk:
break
f_handle.write(chunk)
return await response.release()


async def main(in_a_loop):
urls = LoadedIPCache
async with aiohttp.ClientSession(loop=in_a_loop) as session:
tasks = [download_coroutine(session, url) for url in urls]
await asyncio.gather(*tasks)


# modified fetch function with semaphore, to reduce choking/bottlenecking
async def fetch(url, session):
async with session.get(url) as response:
delay = response.headers.get("DELAY")
date = response.headers.get("DATE")
print("{}:{} with delay {}".format(date, response.url, delay))
return await response.read()


async def bound_fetch(sem, url, session):
# Getter function with semaphore, to reduce choking/bottlenecking
async with sem:
await fetch(url, session)


async def run(r):
tasks = []
# create instance of Semaphore thats 1/10th of the amount of IPs to be scanned
sem = asyncio.Semaphore(r/10)
# Create client session that will ensure we dont open new connection
# per each request.
async with aiohttp.ClientSession() as session:
# Try to pull 1 IP at a time and return it as a simple string.
with open('IPLogList.txt') as cachedIPs:
for line in cachedIPs:
# Debug printer to check if correct IPs are being generated and sent.
#print(line)
#todo WORK NEEDS TO BE DONE AT THIS POINT!
for i in range(r):
# pass Semaphore and session to every GET request
task = asyncio.ensure_future(bound_fetch(sem, line, session))
tasks.append(task)
responses = await asyncio.gather(*tasks)
await responses


def menu():
banner()
global IPList
amount = input("How many IP addresses do you want to scan: ")
loop = asyncio.get_event_loop()
loop.run_until_complete(makeips(amount))

makeips(amount)


while True:
menu()

49 changes: 30 additions & 19 deletions src/v3n0m.py
Expand Up @@ -19,12 +19,12 @@
import inspect
from functools import wraps

except:
except Exception as verb:
print("\n|------ PYTHON PROBLEM DETECTED! Recovery Menu Enabled -----| ")
print(" ")
print(" ")
print(" Exception Error Message encountered: "
"" + str(Exception))
"" + str(verb))
print(" ")
print(" ")
print("|--- You are advised to run either or both steps below ---| ")
Expand All @@ -46,6 +46,11 @@
if chce == '1':
sys.stdout.flush()
print("Warning This will force upgrade all Python3.6 modules")
euid = os.geteuid()
if euid == 0:
print("You Cannot perform any upgrades or repairs while logged in with root permissions, please restart v3n0m.")
time.sleep(6)
os.kill(os.getpid(), 9)
print("You will have 10 seconds to cancel this action before the system begins")
print("Note: This will entirely reinstall all current installed modules aswell to clear possible problems")
time.sleep(10)
Expand All @@ -59,6 +64,11 @@
sys.stdout.flush()
print(
"This will install the missing modules and upgrade them to current versions then update your Python3.6 entirely")
euid = os.geteuid()
if euid == 0:
print("You Cannot perform any upgrades or repairs while logged in with root permissions, please restart v3n0m.")
time.sleep(6)
os.kill(os.getpid(), 9)
print("You will have 10 seconds to cancel this action before the system begins")
time.sleep(10)
call("pip3 install aiohttp --upgrade ", shell=True)
Expand Down Expand Up @@ -627,9 +637,9 @@ def injtest():
sqli_confirmed.write("\n" + hold_the_door)
else:
pass
except FileNotFoundError or Exception:
except FileNotFoundError or Exception as verb:
print("Target file not found!")
print(Exception)
print(str(verb))
time.sleep(2)
fmenu()

Expand Down Expand Up @@ -917,8 +927,8 @@ def ignoringGet(url):
except Exception:
return ''
return responce.text
except Exception:
print(Exception)
except Exception as verb:
print(str(verb))



Expand Down Expand Up @@ -1087,15 +1097,8 @@ def fmenu():
elif chce == '3':
import time
print(B)
euid = os.geteuid()
if euid != 0:
print("Script Not started as root, aquiring root...")
print("Once root is aquired please reselect Toxin from main menu")
time.sleep(4)
args = ['sudo', sys.executable] + sys.argv + [os.environ]
os.execlpe('sudo', *args)
pwd = os.path.dirname(str(os.path.realpath(__file__)))
ftpcrawl = subprocess.Popen('sudo python3.6 ' + pwd + "/modules/toxin.py -i " , shell=True)
ftpcrawl = subprocess.Popen('python3.6 ' + pwd + "/modules/toxin.py -i " , shell=True)
ftpcrawl.communicate()
subprocess._cleanup()
elif chce == '4':
Expand Down Expand Up @@ -1215,6 +1218,7 @@ def fmenu():

# noinspection PyBroadException
def enable_proxy():
import time
global ProxyEnabled
try:
requiresID = bool(
Expand All @@ -1235,15 +1239,19 @@ def enable_proxy():
socks.socket = socks.socksocket
print(" Socks 4 Proxy Support Enabled")
ProxyEnabled = str("True ")
except Exception:
except Exception as verb:
print(str(verb))
time.sleep(5)
pass
else:
try:
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, proxyip, proxyport)
socks.socket = socks.socksocket
print(" Socks 4 Proxy Support Enabled")
ProxyEnabled = str("True ")
except Exception:
except Exception as verb:
print(str(verb))
time.sleep(5)
pass
elif proxytype == str("socks5"):
if requiresID:
Expand All @@ -1254,15 +1262,19 @@ def enable_proxy():
print(" Socks 5 Proxy Support Enabled")
socks.socket = socks.socksocket
ProxyEnabled = str("True ")
except Exception:
except Exception as verb:
print(str(verb))
time.sleep(5)
pass
else:
try:
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxyip, proxyport)
socks.socket = socks.socksocket
print(" Socks 5 Proxy Support Enabled")
ProxyEnabled = str("True ")
except Exception:
except Exception as verb:
print(str(verb))
time.sleep(5)
pass
except Exception:
pass
Expand Down Expand Up @@ -1316,7 +1328,6 @@ def lfi_list_counter():
colMax = 60 # Change this at your will
endsub = 1
gets = 0
timeout = 2
file = "/etc/passwd"
ProxyEnabled = False
menu = True
Expand Down

0 comments on commit f8854c6

Please sign in to comment.