Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amboxer21/sshmonitor

Notifies you of any ssh attempts to your computer, whether the attempts are successful or not. Please fork instead of clone.
https://github.com/amboxer21/sshmonitor

c c-programming daemon gtk2 gui linux monitor notify pytailf python python2 python3 security ssh ssh-monitor

Last synced: 16 days ago
JSON representation

Notifies you of any ssh attempts to your computer, whether the attempts are successful or not. Please fork instead of clone.

Awesome Lists containing this project

README

        

# SSHMonitorPy
Python implementation of SSHMonitor.rb.

SSHMonitorPy notifies you of any ssh attempts to your computer, whether the attempts are successful or not.

Build program:
sudo python setup.py install

Remove program:
python setup.py remove

Modify version in setup.py before building:
setup(
packages=[],
name='sshmonitor',
version='0.0.6', # increment version number

Build package for PyPi:
python setup.py sdist
twine upload dist/*

NOTE: If twine does not work with the above command you can try,
twine upload --repository-url 'https://upload.pypi.org/legacy/' dist/sshmonitor-0.0.6.tar.gz

Contents of ~/.pypirc:
[distutils]
index-servers =
pypi
pypitest

[pypi]
repository=https://pypi.python.org/pypi
username=username
password='password'

[pypitest]
repository=https://testpypi.python.org/pypi
username=username
password='password'

Compile C Module

gcc -c -fPIC masquerade.c -o masquerade.o
gcc masquerade.o -shared -o libmasquerade.so

or

gcc -shared -o libmasquerade.so -fPIC masquerade.c

Compile masquerade(uses pthread)
gcc masquerade.c -o masquerade -lpthread

Building libbuild.so
gcc -c -fPIC src/build.c -o libbuild.o
gcc libbuild.o -shared -o libbuild.so
cp -i src/lib/shared/libbuild.so src/lib/shared/original.libbuild.so
cp libbuild.so src/lib/shared/

>>> import os
>>> import ctypes
>>> shared_object = 'libmasquerade.so'
>>> shared_object_path = os.path.join(*(os.path.split(os.path.__file__)[:-1] + (shared_object, )))
>>> User = ctypes.cdll.LoadLibrary(shared_object_path)
>>> User.masquerade('anthony')

anthony@ghost:~/Documents/Python/sshmonitor/src$ sudo python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, ctypes
>>> from ctypes import cdll
>>> libmasquerade = cdll.LoadLibrary('/home/anthony/Documents/Python/sshmonitor/src/libmasquerade.so')
>>> libmasquerade.masquerade('anthony')
anthony

Compile GTK UI
gcc notify-gtk.c -o notify-gtk `pkg-config --cflags --libs gtk+-2.0`

Create shared object via gcc
gcc -shared -o libmasquerade.so -fPIC masquerade.c -lpthread

Set env
env DISPLAY=:0

Debugging sshmonitor.py

sudo gdb --args python -dv sshmonitor.py --disable-email --verbose