-
Notifications
You must be signed in to change notification settings - Fork 0
/
PotHead.py
97 lines (76 loc) · 3.29 KB
/
PotHead.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
__author__ = '@Slober3'
__version__ = '0.1'
'''
Hello Welcome to this simple low interactinghoneypot
This honepot will only log
And will not interact with the hacker at this point in time!
'''
import sys
sys.path.append('../')
import argparse
import socket
from modules.PotHeadMain import CrlogDir,prPhaseOne,prStandard,runSocketServ
# parse the command line arguments to set the variables for the server
parser = argparse.ArgumentParser(description="Command line arguments")
parser.add_argument('-i',action='store', metavar='<ip address>', default='0.0.0.0', help='The IP address to listen on default 0.0.0.0')
parser.add_argument('-p',action='store', metavar='<port>', default='9999', help='The port to listen on default 9999')
parser.add_argument('-s',action='store', metavar='<PotHeadServer>', default='PotHead', help='A Name that\'ll show up as the VNC server name')
parser.add_argument('-logDir',action='store', metavar='<logDir>', default='logs', help='log Directory')
parser.add_argument('-motd',action='store', metavar='<motd>', default='Welcome to HMLK 612.45', help='MOTD used on this server')
parser.add_argument('-pp',action='store', metavar='<port list>',nargs='+', help='Multiple ports')
parser.add_argument('-site',action='store', metavar='<site>',default='http://7ol.eu/api/write.php', help='Server site')
parser.add_argument('-apikey',action='store', metavar='<apiKey>',default='kwlG4R6i1ESU9d66EBRaWyYaWzJdb38n', help='your API key')
args = parser.parse_args()
# set the IP address, Port, ServerName variables
bind_ip = args.i
bind_port = int(args.p)
srvname = args.s
motd = args.motd
logDirName = args.logDir
multiplePorts = args.pp
site = args.site
apikey = args.apikey
#set Variables for Print messages
banner = ('''
*********************************************************************************************
\tPotHead - A Simple LowInteraction Thing - Version: {}
*********************************************************************************************
'''.format(__version__))
prInitPhead = 'Initializing Pothead service...\n'
prLogCr = 'Log directory created...\n'
prLogCrE = 'Log directory found...\n'
prPhOne = 'Phase 1 completed...\n'
prSrvName = 'Server name: {}\n'.format(srvname)
if args.pp is not None:
prPort = 'Port: {}\n'.format(multiplePorts)
else:
prPort = 'Port: {}\n'.format(bind_port)
prIP = 'IP: {}\n'.format(bind_ip)
prSite ='Site: {}\n'.format(site)
motd += '\r\n'
# Phase 1 Begin:
# Print basic server information ip, port, servname
# Create log directory if not available
print (banner)
print(prInitPhead)
# Check and Create log directory if not exist
# The function ChcklogDir will only check
# and WILL NOT create a log directory if not exists
if CrlogDir(logDirName) == 0:
#prStandard is a basic Print function
prStandard(prLogCr)
else:
prStandard(prLogCrE)
#Prints Basic information
prPhaseOne(prSrvName,prIP,prPort,prPhOne,prSite)
#End Phase 1
#Phase 2 Begin:
#Initiate Socketserver
#Check if multiple ports are used or a single port
if args.pp is not None:
print('Multiple ports used')
runSocketServ(socket.AF_INET, socket.SOCK_STREAM, multiplePorts, socket.gethostname(), 5,4096,motd,1,site,apikey)
else:
print('Single port used')
runSocketServ(socket.AF_INET, socket.SOCK_STREAM, bind_port, socket.gethostname(), 5,4096,motd,0,site,apikey)
#End Phase 2