Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2 died 650 days ago on 1/1/2020 #302

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 40 additions & 30 deletions core/gear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/usr/bin/env python
from __future__ import print_function

import os
import sys

from core.categories import *
import sys, os

try:
raw_input
except NameError:
raw_input = input

# colors
red = "\033[1;31m"
Expand Down Expand Up @@ -40,15 +49,15 @@ def show_categories():
"""
Displays the categories available in the 'categories' dictionary of the core/categories.py file
"""
print "\n%s:: Categories:%s\n" %(green, reset)
print("\n%s:: Categories:%s\n" %(green, reset))
for name in categories.items():
category = name[1][0]
category = format(category)
if name[0]%2 != 0:
print " "+str(name[0]).rjust(2) + ")", category.ljust(23)[:23],
print(" "+str(name[0]).rjust(2) + ")", category.ljust(23)[:23], end="")
else:
print " "+str(name[0]).rjust(2) + ")", category
print " "
print(" "+str(name[0]).rjust(2) + ")", category)
print(" ")

def load_category(key):
"""
Expand All @@ -58,7 +67,7 @@ def load_category(key):
os.system('clear')
category = categories[int(key)][0]
category = format(category)
print green + ":: " + category + reset + "\n"
print(green + ":: " + category + reset + "\n")
show_tools(categories[int(key)][1])
tools = categories[int(key)][1]
site = categories[int(key)][0]
Expand All @@ -68,7 +77,8 @@ def load_category(key):
option = raw_input(": katoolin (%s%s%s) > " %(yellow, site, reset))
except KeyboardInterrupt:
delete_repository()
print "..."; break
print("...")
break
try:
if option == 'back':
delete_repository()
Expand All @@ -91,31 +101,31 @@ def load_category(key):
except:
pass
else:
print red + "E: The command is invalid!" + reset
print(red + "E: The command is invalid!" + reset)

def search_tool(tool):
"""
Shows in which category the tool you are looking for is available
"""
print ": Find " + yellow + tool + reset
print ": Available in:"
print(": Find " + yellow + tool + reset)
print(": Available in:")
for lists in categories.items():
tools = lists[1][1]
category = lists[1][0]
category = format(category)
if tool in tools:
print " [%s+%s] %s" %(green, reset, category)
print(" [%s+%s] %s" %(green, reset, category))

def show_tools(tools):
"""
Show all tools in the loaded category
"""
for tool in enumerate(tools):
if tool[0]%2 == 0:
print " "+str(tool[0]+1).rjust(2) + ")", tool[1].ljust(23)[:23],
print(" "+str(tool[0]+1).rjust(2) + ")", tool[1].ljust(23)[:23], end="")
else:
print " "+str(tool[0]+1).rjust(2) + ")", tool[1]
print "\n 99) ALL"
print(" "+str(tool[0]+1).rjust(2) + ")", tool[1])
print("\n 99) ALL")

def add_repository():
"""
Expand All @@ -128,10 +138,10 @@ def add_repository():
f = open("/etc/apt/sources.list.d/katoolin.list", "wb")
f.write("#Katoolin\ndeb http://http.kali.org/kali kali-rolling main contrib non-free\n# For source package access, uncomment the following line\n# deb-src http://http.kali.org/kali kali-rolling main contrib non-free\n")
f.close()
print green + "\n[+] Add repository\n" + reset
print(green + "\n[+] Add repository\n" + reset)
add_key()
except IOError:
print red+"E: Please run as root"+reset
print(red+"E: Please run as root"+reset)
sys.exit()

def delete_repository():
Expand All @@ -141,7 +151,7 @@ def delete_repository():
repository = "/etc/apt/sources.list.d/katoolin.list"
if os.path.exists(repository):
os.remove(repository)
print green + "\n[+] Repository deleted\n" + reset
print(green + "\n[+] Repository deleted\n" + reset)

def add_key():
"""
Expand All @@ -155,9 +165,9 @@ def add_key():
f = open(tmp_key, "wb")
f.write("katoolin\n")
f.close()
print green + "\n[+] Add keyserver\n" + reset
print(green + "\n[+] Add keyserver\n" + reset)
os.system('apt-get update -o Dir::Etc::sourcelist="sources.list.d/katoolin.list" -o Dir::Etc::sourceparts="-" -o apt::Get::List-Cleanup="0"')
print green + "\n[+] Update\n" + reset
print(green + "\n[+] Update\n" + reset)

def banner():
version = "v1.3b"
Expand All @@ -169,7 +179,7 @@ def banner():

4) Exit
"""
print """
print("""
$$\ $$\ $$\ $$\ $$\
$$ | $$ | $$ | $$ |\__|
$$ |$$ / $$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ $$ |$$\ $$$$$$$\
Expand All @@ -180,45 +190,45 @@ def banner():
\__| \__| \_______| \____/ \______/ \______/ \__|\__|\__| \__| %s%s

%s+ -- -- +=[ Original project: https://github.com/LionSec/katoolin | LionSec
+ -- -- +=[ %s Tools%s""" %(cyan,reset,cyan,version,reset,green,tools,reset)
print options
+ -- -- +=[ %s Tools%s""" %(cyan,reset,cyan,version,reset,green,tools,reset))
print(options)

def update():
"""
Update 'katoolin' with: git pull
"""
try:
os.system('git pull')
print yellow + "W: Please restart katoolin" + reset
print(yellow + "W: Please restart katoolin" + reset)
except:
print red + "E: can't start update please use <git pull>"+reset
print(red + "E: can't start update please use <git pull>"+reset)

def help(x=False):
"""
Displays tool help
"""
if x != True:
print """: load=<category> Load category
print(""": load=<category> Load category
: search=<tool> Find tool
: clear Clean screen
: 1, show Show categories
: 2, update Update katoolin (git pull)
: 3, help Show help
: 4, exit Exit katoolin"""
: 4, exit Exit katoolin""")
else:
print """: <option> Install tool
print(""": <option> Install tool
: 99 Install all tools in the category
: back Return to previous menu
: clear Clean screen
: show Show tools
: help Show help"""
: help Show help""")

def clean_screen():
os.system('clear')
banner()

def exit():
print "\nClosing, bye! - katoolin"
print("\nClosing, bye! - katoolin")
sys.exit()

def num_tools():
Expand All @@ -234,4 +244,4 @@ def num_tools():
def format(category):
category = category.replace('_', ' ')
category = category.title()
return category
return category
Loading