Skip to content

Commit

Permalink
Merged plugins.txt.
Browse files Browse the repository at this point in the history
  • Loading branch information
auroraaxela committed May 2, 2016
2 parents cad4894 + 5c8b14e commit f54fe10
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 105 deletions.
139 changes: 137 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,140 @@
# SuperHoneyPot

Requirements are here: https://github.com/redragonx/HoneyPotExtras
The honey pot allows connections to be made to it, and mimics the appropriate protocols that are defined as plugins without actually allowing access. It gathers information from whoever attempts the connection, and stores the information remotely in a MongoDB database. This application was built around running on a RaspberryPi Zero to make it easy to deploy in any physical environment with a network. We wanted a cost effective solution that could be installed in a matter of minutes.

[![Build Status](https://travis-ci.org/TheFixers/SuperHoneyPot.svg?branch=master)](https://travis-ci.org/TheFixers/SuperHoneyPot)

Text file Client Requirements are here: https://github.com/redragonx/HoneyPotExtras

[![Build Status](https://travis-ci.org/TheFixers/SuperHoneyPot.svg?branch=master)](https://travis-ci.org/TheFixers/SuperHoneyPot)


Navigation
----------
[SuperHoneyPot](#superhoneypot) |
[Requirements](#requirements) |
[Folder Structure](#folder-structure) |
[Installation](#installation) |
[Development](#development) |
[Deployment](#deployment) |
[Contributions](#contributions) |
[Team](#team) |
[Copyright](#copyright) |
[Licence](#licence) |
[Contact](#contact)


Requirements
------------
This project assumes you have some python know how.

Folder Structure
----------------
<pre>
.
├── blah.txt
├── honeypot
│   ├── CHANGELOG.md
│   ├── data_files
│   │   ├── __init__.py
│   │   ├── mail_info.txt
│   │   ├── mongoClient.txt
│   │   ├── plugins.txt
│   │   ├── privateSSHKey.key
│   │   └── ssl.pem
│   ├── db_interface
│   │   ├── honeypot_db_interface.py
│   │   ├── honeypot_db_interface.pyc
│   │   ├── __init__.py
│   │   └── python_mail.py
│   ├── demo_server.log
│   ├── honey_loader
│   │   ├── __init__.py
│   │   ├── loader.py
│   │   ├── loader.pyc
│   │   ├── __main__.py
│   │   ├── pluginsReader.py
│   │   └── version.py
│   ├── __init__.py
│   ├── LICENSE
│   ├── MANIFEST.in
│   ├── plugins
│   │   ├── http_reader.py
│   │   ├── http_reader.pyc
│   │   ├── https_reader.py
│   │   ├── https_reader.pyc
│   │   ├── __init__.py
│   │   ├── ssh_plugin.py
│   │   ├── ssh_plugin.pyc
│   │   ├── telnet_reader.py
│   │   └── telnet_reader.pyc
│   ├── README.txt
│   ├── requirements.txt
│   ├── requires.txt
│   ├── setup.py
│   └── tests
│   ├── http_reader_test.py
│   ├── https_reader_test.py
│   ├── loader_test.py
│   ├── plugin_test.py
│   ├── ssh_plugin_test.py
│   └── telnet_reader_test.py
└── README.md

6 directories, 42 files

</pre>

Installation
------------
<ul>
<li> Install Python 2.7.11</li>
<li>You will need to have an instance of MongoDB server installed remotely, and add the access details to the mongoClient.txt configuration file.</li>
<li> Install dependencies: go to your project directory and type <code>pip -r requirements.txt</code></li>
<li> Install nose tests if you want to run the tests</li>
</ul>

Development
-----------------------
put text here.

Deployment
----------
There are a few ways to run the app, but first edit the login details for the database and email (used for adminsterating) under data_files folder. Then run `sudo python honeypot/honey_loader/loader.py` to test your changes. Or you can create a package for your OS.

For Debian: You'll need <a href="https://pypi.python.org/pypi/stdeb">stdeb</a> then run `python setup.py --command-packages=stdeb.command bdist_deb` in the honeypot folder. Install the .deb file. Then run `sudo honeypot`

For Pip: Run `python setup.py sdist` then run `sudo python setup.py install` To run it `sudo honeypot`

Please note that your config files in data_files will be whatever they are set to when building a package. You may need to change them after installing the package.

Contributions
-------------
We would love for other people to contribute to this. All work should be done on feature-specific branches and pull requests will be moderated by admins. :)

#### General workflow
* `Make a new fork`
* `git branch <new branch>`
* `git checkout <new branch>`
* `git push -u origin <new branch>`

Team
----

- Chris Benda
- Stephen Chavez
- Fred Montoya
- Mikhail Batkalin
- Brad Gill
- William King

Copyright
---------
&copy; 2016 Stephen Chavez

Licence
-------
AGPL

Contact
-------
Email: <a href="mailto:[email protected]">[email protected]</a>
3 changes: 1 addition & 2 deletions honeypot/data_files/plugins.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#root
http_reader 80 8080
https_reader 443 17603
ssh_plugin 22 4343
telnet_reader 23 25
telnet_reader 23 25
7 changes: 3 additions & 4 deletions honeypot/honey_loader/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ def start():
try:
# Read through the plugin list and load them with the indicated ports
lock = threading.Lock()
for line in lines:
plug = line.pop(0) #first index is plugin name
plugin = __import__(plug)
for port in line:
for key in lines: #first index is plugin name
plugin = __import__(key)
for port in lines[key]:
try:
plugins.append(plugin.server_plugin(lock, port))
except socket.error as msg:
Expand Down
65 changes: 32 additions & 33 deletions honeypot/honey_loader/pluginsReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
def lineReader():
path = os.path.dirname(os.path.realpath(__file__)).replace("honey_loader", "data_files")
text_file = open(path + os.path.sep + "plugins.txt", "r")
lines = removeExtraLines(re.split ('\n', text_file.read()))
lines = lines_to_line_plus_port(lines)
lines = dashes(lines)
lines = repeat_check(lines)
return lines
return removeExtraLines(re.split ('\n', text_file.read()))

"""
removes lines that start with # and blank lines
Expand All @@ -37,26 +33,37 @@ def removeExtraLines(lines):
for line in lines:
if line != '' and line[:1] != '#' and not line.isspace():
temp.append(line)
return temp
return lines_to_line_plus_port(temp)

"""
array example ['http_reader', '80', '1111']
returns plugin in first lines_to_line_plus_port(position followed by ports to be used by plugin)
temp example [['http_reader', '80', '1111'], ...]
arr example {'http_reader' : ['80', '1111'], ...}
returns plugin in first plines_to_line_plus_port(osition followed by ports to be used by plugin
"""
def lines_to_line_plus_port(lines):
temp = []
arr = {}
for line in lines:
temp.append(line.split())
return temp

for line in temp:
key = line.pop(0);
if key in arr:
arr[key] = set(arr[key] + line)
else:
arr[key] = line
return dashes(arr)

"""
Checks to see if there are dashes in between port numbers, and then creates a range of ports to open
lines begining example {'http_reader' : ['80-82', '1111'], ...}
lines ending example {'http_reader' : ['80', '81', '82', '1111'], ...}
"""
def dashes(lines):
temp = []
lineArray = []
for line in lines:
for port in line:
for key in lines:
for port in lines[key]:
if '-' in port:
ranges = port.split('-')
lowerLimit = int(float(ranges[0]))
Expand All @@ -70,34 +77,26 @@ def dashes(lines):
lineArray.append(str(upperLimit))
else:
lineArray.append(port)
temp.append(lineArray[:])
lines[key] = lineArray[:]
del lineArray[:]
return temp
return repeat_check(lines)

"""
Checks the list again for repeats of plugin names or duplicate port numbers.
"""
def repeat_check(lines):
ports = []
plugins = []
array = []
temp = []
for line in lines:
if not line[0] in plugins:
plugins.append(line[0])
array.append(line.pop(0))
for port in line:
if not port in ports:
ports.append(port)
array.append(port)
else:
print 'Error: attempted to open port:' + port + ' twice. This is not allowed. Only running first mention.'
temp.append(array[:])
del array[:]
else:
print 'Error: attempted to have multiple lines of plugin: ' + line[0] + '. This is not allowed.'

return temp
useablePorts = []
for key in lines:
for port in lines[key]:
if not port in ports:
ports.append(port)
useablePorts.append(port)
else:
print 'Error: attempted to open port:' + port + ' twice. This is not allowed. Only running first mention.'
lines[key] = useablePorts[:]
del useablePorts[:]
return lines


if __name__ == '__main__':
Expand Down
Loading

0 comments on commit f54fe10

Please sign in to comment.