snovvcrash / usbrip

Tracking history of USB events on GNU/Linux
https://habr.com/ru/post/352254/
GNU General Public License v3.0
1.15k stars 109 forks source link

sys.exit(main()) #9

Closed goxy2101 closed 5 years ago

goxy2101 commented 5 years ago

Tool started from terminal with processing a syslog file with command: usbrip events violations auth.json -f syslog and after couple of seconds stop with errors:

[] Started at 2019-08-12 00:43:57 [00:43:57] [INFO] Reading "syslog" Traceback (most recent call last): File "/usr/local/bin/usbrip", line 10, in sys.exit(main()) File "/opt/usbrip/venv/lib/python3.7/site-packages/usbrip/main.py", line 126, in main uev = USBEvents(args.file) File "/opt/usbrip/venv/lib/python3.7/site-packages/usbrip/lib/core/usbevents.py", line 93, in new all_events = _parse_history(divided_history) File "/opt/usbrip/venv/lib/python3.7/site-packages/usbrip/lib/core/usbevents.py", line 343, in _parse_history for (date, action), logs in _sort_by_date(divided_history.items()): File "/opt/usbrip/venv/lib/python3.7/site-packages/usbrip/lib/core/usbevents.py", line 434, in _sort_by_date return sorted(unsorted_log, key=lambda i: MONTH_ENUM[i[0][0][:3]] + i[0][0][3:]) File "/opt/usbrip/venv/lib/python3.7/site-packages/usbrip/lib/core/usbevents.py", line 434, in return sorted(unsorted_log, key=lambda i: MONTH_ENUM[i[0][0][:3]] + i[0][0][3:]) KeyError: '201' [] Shutted down at 2019-08-12 00:44:03 [*] Time taken: 0:00:05.211522

Version: v2.1.3-3 - because of ald date/time log format data in syslog file Python 3.7.4

Installation passed ok

root@kali:~/Desktop/_TOOLS/USB/usbrip-3fb6103a76d2955a5cd75152b1036fa2ab44abb8# ./installers/install.sh

Creating directory: '/opt/usbrip' Successfully created directory: '/opt/usbrip'

Creating directory: '/var/opt/usbrip/log' Successfully created directory: '/var/opt/usbrip/log'

Creating directory: '/var/opt/usbrip/storage' Successfully created directory: '/var/opt/usbrip/storage'

Building Python virtual environment Successfully builded Python virtual environment

Installing usbrip Processing /root/Desktop/Desktop/Boxes/_TOOLS/USB/usbrip-3fb6103a76d2955a5cd75152b1036fa2ab44abb8 Collecting termcolor (from usbrip==2.1.3.post3) Collecting terminaltables (from usbrip==2.1.3.post3) Building wheels for collected packages: usbrip Running setup.py bdist_wheel for usbrip ... done Stored in directory: /root/.cache/pip/wheels/67/21/71/a4eb3a95286cc8a05987071f2e8b22e379adc4d387f8ebe94b Successfully built usbrip Installing collected packages: termcolor, terminaltables, usbrip Successfully installed termcolor-1.1.0 terminaltables-3.1.0 usbrip-2.1.3.post3 Successfully installed usbrip using PyPI dependencies

/opt/usbrip/venv/lib/python3.7/site-packages/setuptools/dist.py:475: UserWarning: Normalizing '2.1.3-3' to '2.1.3.post3' normalized_version, running clean

Created symlink: '/usr/local/bin/usbrip' Done.

snovvcrash commented 5 years ago

Take a look at this issue and a new requirement for the syslog structure.