Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import signal
- from os import system
- signal.signal(signal.SIGINT, signal.SIG_IGN)
- class CommandLine:
- def cmd_look(self, cmd):
- self.cmd = cmd
- b_command = lambda w,s: set(w).intersection(s.split())
- blocked_command = [
- "echo","crontab","cron"
- ]
- try:
- cmd = cmd
- except (KeyboardInterrupt,EOFError) as exception_error:
- system('clear')
- pass
- else:
- if ( b_command(blocked_command,cmd) ):
- print("BLOCKED")
- exit()
- elif ( cmd == "exit" ):
- exit()
- else:
- system(cmd)
- def __init__(self):
- try:
- cmd = input("do> ")
- except (KeyboardInterrupt,EOFError) as exception_error:
- system('clear')
- pass
- else:
- self.cmd_look(cmd)
- while( True ):
- CommandLine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement