Python for Ethical Hackers
Mohammad reza Kamalifard
kamalifard@datasec.ir
Python Language Essentials
Part 6 :
Signals
Mohammad reza Kamalifard
Kamalifard.ir/pysec101
# Signals
Allows handling of Asynchronous events
SIGKILL is what gets sent when you use "kill -9"
Programming with Signals...
Signals
$ man 7 signal for list of Signals (in unix shell)
SIGINT Interrupt from keyboard when you press Ctrl + C
SIGKILL ...
Signal Handler
import signal
# Signal handler
def ctrlc_handler(sign_value, frm):
print "Haha!You Cannot Kill me!"
print "...
Installing signal Handler
Done!
^CHaha!You Cannot Kill me!
^CHaha!You Cannot Kill me!
^CHaha!You Cannot Kill me!
^CHaha!Yo...
This work is licensed under the Creative Commons
Attribution-NoDerivs 3.0 Unported License.
To view a copy of this license...
Upcoming SlideShare
Loading in …5
×

اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی

343 views

Published on

برای دانلود به
kamalifard.ir/pysec101
مراجعه کنید

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

اسلاید ارائه دوم جلسه ۱۰ کلاس پایتون برای هکر های قانونی

  1. 1. Python for Ethical Hackers Mohammad reza Kamalifard kamalifard@datasec.ir
  2. 2. Python Language Essentials Part 6 : Signals Mohammad reza Kamalifard Kamalifard.ir/pysec101
  3. 3. # Signals Allows handling of Asynchronous events SIGKILL is what gets sent when you use "kill -9" Programming with Signals is easy Mohammad reza Kamalifard Kamalifard.ir/pysec101
  4. 4. Signals $ man 7 signal for list of Signals (in unix shell) SIGINT Interrupt from keyboard when you press Ctrl + C SIGKILL Kill signal SIGINT 2 Term Interrupt from keyboard SIGQUIT 3 Core Quit from keyboard SIGILL 4 Core Illegal Instruction SIGABRT 6 Core Abort signal from abort(3) SIGFPE 8 Core Floating point exception SIGKILL 9 Term Kill signal SIGSEGV 11 Core Invalid memory reference Mohammad reza Kamalifard Kamalifard.ir/pysec101
  5. 5. Signal Handler import signal # Signal handler def ctrlc_handler(sign_value, frm): print "Haha!You Cannot Kill me!" print "Installing signal Handler" signal.signal(signal.SIGINT, ctrlc_handler) print "Done!" while True: pass Mohammad reza Kamalifard Kamalifard.ir/pysec101
  6. 6. Installing signal Handler Done! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! ^CHaha!You Cannot Kill me! Mohammad reza Kamalifard Kamalifard.ir/pysec101
  7. 7. This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/ Copyright 2013 Mohammad reza Kamalifard. All rights reserved.

×