mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
Temporary code to randomly insult user when vi is started multiple times
This commit is contained in:
parent
cfaae0fe35
commit
16989baa5f
1 changed files with 8 additions and 3 deletions
11
aha/aha.py
11
aha/aha.py
|
@ -2,7 +2,7 @@
|
|||
#Core of the adaptive honeypot alternative
|
||||
# (c) Gerard Wagener
|
||||
#License GPL
|
||||
import os,sys
|
||||
import os,sys,random
|
||||
from pyinotify import *
|
||||
from ctypes import *
|
||||
KERNEL_OUT="/home/gerard/kernel/linux-2.6/out"
|
||||
|
@ -22,7 +22,6 @@ class KERNEL_ERRORS():
|
|||
self.evec = (EPERM,ENOENT,EIO,ENOMEM,EACESS,EFAULT,EPIPE,ETXTBSY)
|
||||
|
||||
|
||||
|
||||
class ReplyMessage(Structure):
|
||||
_fields_ = [ ("block" , c_int), ("exitcode" , c_int),
|
||||
("substitue" ,c_int),("insult" , c_int) ]
|
||||
|
@ -61,15 +60,21 @@ class KernelEvents(ProcessEvent):
|
|||
return msg
|
||||
|
||||
def decision(self,filekey,msg):
|
||||
insultmaxidx = 3
|
||||
print msg
|
||||
try:
|
||||
command = msg['file'][0]
|
||||
print "Got command: ",command
|
||||
if msg['file'][0] == '/usr/bin/vi':
|
||||
if msg['file'][0] == '/usr/bin/bvi':
|
||||
self.create_message(filekey, block=1,
|
||||
exitcode=KERNEL_ERRORS.ENOMEM,
|
||||
insult = 0, substitue=0)
|
||||
return
|
||||
if msg['file'][0] == '/usr/bin/vi':
|
||||
# The index 0 is reserved
|
||||
idx = random.randint(1,insultmaxidx)
|
||||
self.create_message(filekey, block=0, exitcode=0, insult=idx, substitue=0)
|
||||
return
|
||||
except KeyError,e:
|
||||
pass
|
||||
except IndexError,w:
|
||||
|
|
Loading…
Reference in a new issue