Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend upload failed #19

Closed
timhux123 opened this issue Mar 8, 2019 · 2 comments
Closed

Backend upload failed #19

timhux123 opened this issue Mar 8, 2019 · 2 comments

Comments

@timhux123
Copy link

timhux123 commented Mar 8, 2019

Ubuntu 16.04.2 LTS
Cloned and manually installed the current version using the steps on the website:

apt-get install -y python-pip libmysqlclient-dev python-mysqldb git sqlite3
git clone https://github.com/Phype/telnet-iot-honeypot.git
cd telnet-iot-honeypot
pip install -r requirements.txt
sudo apt-get install python-setuptools python-werkzeug
python-flask python-flask-httpauth python-sqlalchemy
python-requests python-decorator python-dnspython
python-ipaddress python-simpleeval python-yaml
bash create_config.sh
python backend.py
python honeypot.py

The backend and honey front-end start successfully.
I can successfully access the front-end at http://localhost:5000.

I attempted to telnet using "telnet 127.0.0.1 2323" and the session was successful.
I ended the telnet session but no data is pushed to the database.
Data is pushed to the logfile I configured in config.dist.yaml.

The following error on the honeypot.py terminal after closing the telnet session:

~/telnet-iot-honeypot$ python honeypot.py
/home/atr/.local/lib/python2.7/site-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
2019-03-08 08:01:53 telnet.py:86 Socket open on :2323
2019-03-08 08:02:00 telnet.py:99 Client connected at ('127.0.0.1', 58430)
2019-03-08 08:02:00 session.py:24 New Session
2019-03-08 08:02:00 telnet.py:127 Setting timeout to 60 seconds
2019-03-08 08:02:09 session.py:37 Session login: user=aaa password=aaa
2019-03-08 08:02:26 telnet.py:161 Connection closed
2019-03-08 08:02:26 session.py:68 Session End
2019-03-08 08:02:26 client.py:44 Backend upload failed, retrying ()
Unhandled exception in thread started by <bound method TelnetSess.loop of <honeypot.telnet.TelnetSess instance at 0x7fb164e4b0e0>>
Traceback (most recent call last):
File "/home/atr/telnet-iot-honeypot/honeypot/telnet.py", line 163, in loop
self.session.end()
File "/home/atr/telnet-iot-honeypot/honeypot/session.py", line 76, in end
self.record.commit()
File "/home/atr/telnet-iot-honeypot/honeypot/sampledb_client.py", line 134, in commit
upload_req = self.back.put_session(self.json())
File "/home/atr/telnet-iot-honeypot/honeypot/client.py", line 45, in put_session
return self.put_session(session, False)
File "/home/atr/telnet-iot-honeypot/honeypot/client.py", line 48, in put_session
raise

And this is the error on the screen running backend.py:

~/telnet-iot-honeypot$ python backend.py
/home/atr/.local/lib/python2.7/site-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
Creating/Connecting to DB
DB Setup done

  • Restarting with stat
    /home/atr/.local/lib/python2.7/site-packages/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
    warnings.warn(warning, RequestsDependencyWarning)
    Creating/Connecting to DB
    DB Setup done
  • Debugger is active!
  • Debugger PIN: 293-544-861
    (12730) wsgi starting up on http://127.0.0.1:5000
    (12730) accepted ('127.0.0.1', 42704)
    Traceback (most recent call last):
    File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
    File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
    File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
    File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
    File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
    File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functionsrule.endpoint
    File "/home/atr/.local/lib/python2.7/site-packages/flask_httpauth.py", line 104, in decorated
    return f(*args, **kwargs)
    File "/home/atr/telnet-iot-honeypot/backend/backend.py", line 108, in put_conn
    session = ctrl.put_session(session)
    File "</home/atr/.local/lib/python2.7/site-packages/decorator.pyc:decorator-gen-6>", line 2, in put_session

File "/home/atr/telnet-iot-honeypot/backend/db.py", line 31, in db_wrapper
return func(*args, **kwargs)
File "/home/atr/telnet-iot-honeypot/backend/clientcontroller.py", line 230, in put_session
range = self.get_ip_range(conn.ip)
File "/home/atr/telnet-iot-honeypot/backend/clientcontroller.py", line 168, in get_ip_range
return self.get_ip_range_online(ip)
File "/home/atr/telnet-iot-honeypot/backend/clientcontroller.py", line 156, in get_ip_range_online
range.country = addinfo["country"]
TypeError: 'NoneType' object has no attribute 'getitem'
127.0.0.1 - - [08/Mar/2019 08:03:02] "PUT /conns HTTP/1.1" 500 24562 0.103092
(12730) accepted ('127.0.0.1', 42706)
Traceback (most recent call last):
File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/home/atr/.local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/atr/.local/lib/python2.7/site-packages/flask_httpauth.py", line 104, in decorated
return f(*args, **kwargs)
File "/home/atr/telnet-iot-honeypot/backend/backend.py", line 108, in put_conn
session = ctrl.put_session(session)
File "</home/atr/.local/lib/python2.7/site-packages/decorator.pyc:decorator-gen-6>", line 2, in put_session

File "/home/atr/telnet-iot-honeypot/backend/db.py", line 31, in db_wrapper
return func(*args, **kwargs)
File "/home/atr/telnet-iot-honeypot/backend/clientcontroller.py", line 230, in put_session
range = self.get_ip_range(conn.ip)
File "/home/atr/telnet-iot-honeypot/backend/clientcontroller.py", line 168, in get_ip_range
return self.get_ip_range_online(ip)
File "/home/atr/telnet-iot-honeypot/backend/clientcontroller.py", line 156, in get_ip_range_online
range.country = addinfo["country"]
TypeError: 'NoneType' object has no attribute 'getitem'
127.0.0.1 - - [08/Mar/2019 08:03:02] "PUT /conns HTTP/1.1" 500 24562 0.032411

Any idea?

Phype pushed a commit that referenced this issue Mar 8, 2019
@Phype
Copy link
Owner

Phype commented Mar 8, 2019

Ok, that was a obvious bug i should have tested when rebuilding the ip lookup. Should work with the latest commit. Problem was just that 127.0.0.1 has no ASN lookup obviously.

@Phype Phype closed this as completed Mar 8, 2019
@timhux123
Copy link
Author

Thank you for the quick reply! Issue fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants