Skip to content

Commit

Permalink
add ifconfig and it works message
Browse files Browse the repository at this point in the history
  • Loading branch information
HackingDave committed Mar 29, 2019
1 parent 1bd6cb7 commit 5f7f067
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
~~~~~~~~~~~~~~~~
version 1.0
~~~~~~~~~~~~~~~~

* added automatic default website for when using TrevorC2 if no connection available (i.e. cant clone website) - will spawn a It Works! site.
* added ability to list ifconfig for connection within trevorc2 prompt

~~~~~~~~~~~~~~~~
version 0.9
~~~~~~~~~~~~~~~~
Expand Down
27 changes: 20 additions & 7 deletions trevorc2_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import urllib3
import requests
import threading
import subprocess
try:
import tornado.web
import tornado.ioloop
Expand Down Expand Up @@ -162,14 +163,19 @@ def clone_site(user_agent, url):

# run our wget
print("[*] Cloning website: " + url)
web_request = requests.get(url, headers={'User-Agent': user_agent}, verify=0)
if web_request.status_code != 200 or len(web_request.content) < 1:
print("[!] Unable to clone the site. Status Code: %s" % web_request.status_code)
print("[!] Exiting TrevorC2...")
sys.exit()
try:
web_request = requests.get(url, headers={'User-Agent': user_agent}, verify=0)
if web_request.status_code != 200 or len(web_request.content) < 1:
print("[!] Unable to clone the site. Status Code: %s" % web_request.status_code)
print("[!] Exiting TrevorC2...")
sys.exit()

with open("clone_site/index.html", 'wb') as fh:
fh.write(web_request.content)

with open("clone_site/index.html", 'wb') as fh:
fh.write(web_request.content)
except requests.ConnectionError:
print("[-] Unable to clone website due to connection issue (are you connected to the Internet?), writing a default one for you...")
with open("clone_site/index.html", "w") as fh: fh.write("<head></head><html><body>It Works!</body></html>")

# report success
if os.path.isfile("clone_site/index.html"):
Expand Down Expand Up @@ -338,7 +344,9 @@ def main_c2():
print("Command Usage:\n")
print("list - will list all shells available")
print("interact <id> - allow you to select which shells to interact with\n")
print("ifconfig - allows you to see your interface data for server")

# list available shells
if task == "list":
counter = 0
print("\n*** Available TrevorC2 Shells Below ***\n")
Expand All @@ -354,6 +362,11 @@ def main_c2():

if task == "interact": print("[!] Correct usage: interact <session_id>")

if task == "ifconfig":
stdout = subprocess.Popen("ifconfig", shell=True)
proc = stdout.communicate()[0]
print(proc)

if task == "quit" or task == "exit":
print("[*] Exiting TrevorC2... ")
os.system('kill $PPID') # This is an ugly method to kill process, due to threading this is a quick hack to kill with control-c. Will fix later.
Expand Down

0 comments on commit 5f7f067

Please sign in to comment.