From 7eb6d969ba3032822505c5ceef34fe0879e186fa Mon Sep 17 00:00:00 2001 From: m0rv4i Date: Wed, 13 Feb 2019 16:38:17 +0000 Subject: [PATCH] Removed C2Viewer.py and added instructions for same functionality to readme just using system commands --- C2Viewer.py | 91 --------------------------------------------------- README.md | 12 +++++++ changelog.txt | 1 + 3 files changed, 13 insertions(+), 91 deletions(-) delete mode 100644 C2Viewer.py diff --git a/C2Viewer.py b/C2Viewer.py deleted file mode 100644 index 628761e..0000000 --- a/C2Viewer.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python - -from Colours import * -from Config import * -from DB import * -from Help import * -import time, os - -rows = 10 -taskid = 0 - -try: - if os.name == 'nt': - os.system('cls') - else: - os.system('clear') -except Exception as e: - print "cls" - print chr(27) + "[2J" - -print (Colours.GREEN + "") -print (logopic) -print (Colours.END + "") - -try: - taskid = get_seqcount("Tasks") + 1 -except Exception as e: - user = "None" - taskid = 1 - -try: - newtaskid = get_seqcount("NewTasks") + 1 -except Exception as e: - user = "None" - newtaskid = 1 - -try: - implantid = get_seqcount("Implants") + 1 -except Exception as e: - user = "None" - implantid = 1 - -#print newtaskid -while(1): - try: - newtask = get_newtasksbyid(newtaskid) - hostinfo = get_hostinfo(newtask[1]) - now = datetime.datetime.now() - command = newtask[2] - print Colours.YELLOW - print "Command issued against implant %s on host %s %s (%s)" % (hostinfo[0],hostinfo[3],hostinfo[11],now.strftime("%m/%d/%Y %H:%M:%S")) - - if (command.lower().startswith("$shellcode64")) or (command.lower().startswith("$shellcode64")) : - print "Loading Shellcode",Colours.END - elif (command.lower().startswith("$shellcode86")) or (command.lower().startswith("$shellcode86")) : - print "Loading Shellcode",Colours.END - elif "upload-file" in command.lower(): - print "Uploading File",Colours.END - else: - print command,Colours.END - - newtaskid = newtaskid + 1 - except Exception as e: - user = "None" - - try: - completedtask = get_tasksbyid(taskid) - hostinfo = get_hostinfo(completedtask[2]) - now = datetime.datetime.now() - if hostinfo: - print Colours.GREEN - print "Command returned against implant %s on host %s %s (%s)" % (hostinfo[0],hostinfo[3],hostinfo[11],now.strftime("%m/%d/%Y %H:%M:%S")) - print completedtask[4],Colours.END - taskid = taskid + 1 - except Exception as e: - user = "None" - - try: - implant = get_implantbyid(implantid) - if implant: - print Colours.GREEN - print "New %s implant connected: (uri=%s key=%s) (%s)" % (implant[15], implant[1], implant[5], now.strftime("%m/%d/%Y %H:%M:%S")) - print "%s | URL:%s | Time:%s | PID:%s | Sleep:%s | %s (%s) " % (implant[4], implant[9], implant[6], - implant[8], implant[13], implant[11], implant[10]) - print Colours.END - implantid = implantid + 1 - except Exception as e: - user = "None" - - time.sleep(1) - diff --git a/README.md b/README.md index 601b45d..2c51a9f 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,18 @@ chmod +x ./Install.sh powershell -exec bypass -c "IEX (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/nettitude/PoshC2/master/C2-Installer.ps1')" ``` +## Viewing the logs + +If you want others to be able to to just view the C2 output you can pipe the C2Server.py to a file and stdout with: + +`python -u C2Server.py | tee -a /var/log/poshc2_server.log` + +Note the `-u` option is required to prevent buffering. + +Then you can view it with + +`tail -f -n 50 /var/log/poshc2_server.log` + ## Installing as a service Installing as a service provides multiple benefits such as being able to log to service logs, viewing with journalctl and automatically starting on reboot. diff --git a/changelog.txt b/changelog.txt index 1541ebf..93e5a67 100644 --- a/changelog.txt +++ b/changelog.txt @@ -28,6 +28,7 @@ Added validation for beacon time that it matches the correct format Fix StartAnotherImplant command for python implant Rename RandomURI column in html output to Context, and print it as domain\username @ hostname Move service instructions to readme so that poshc2.service can just be copied to /lib/systemd/system +Removed C2Viewer.py and added instructions for same functionality to readme just using system commands 4.7 (03/02/19) ==============