写了个小工具FaultTestTools,专用于服务端故障注入
2016-09-09 10:26
267 查看
"""
auth : wenshan
time :
version : v1.0.0
"""
import main
import time
if __name__ == "__main__":
while True:
try:
inputName = raw_input("""
1.reboot :reboot the PC.
2.service_stop -name :stop service.
service_start -name :start service.
3.customer_stop -name :run customer command.
customer_start -name :run customer command.
4.cpu_limit_start -processName -rate
:limit the process under the rate.
cpu_limit_stop :stop the service cpulimt.
cpu_nervous -rate :cpu nervous,havn't recover funtion.
5.mem_leak :mem nervous,havn't recover funtion.
6.process_leak :loop create process.havn't recover funtion.
thread_lead :loop create thread.havn't recover funtion.
7.disk_full_all :fill all disk.
disk_full_all_recover :recover
disk_full_customer -filename -mbytes
:create a file.havn't recover funtion.
disk_slow -swapname -gbytes -seconds
:disk slow.havn't recover funtion.
8.network_delay -msdelaytime :delay the network
network_delay_stop -msDelayTime :recover
network_wave_delay -startMsDelayTime -endMsDelayTime
:wave delay
network_wave_delay_stop -startMsDelayTime -endMsDelayTime
:recover
network_limit -kbit :limit network
network_limit_stop -kbit :recover
network_package_corrupt -rate :package corrupt
network_package_corrupt_stop -rate
:recover
network_package_lost -rate :package lost
network_package_lost_stop -rate :recover
network_package_duplicate -rate :package duplicate
network_package_duplicate_stop -rate
:recover
9.ulimit -number :limit the file handler
apache_maxclients :change the apache max clients
10.exit\n\nplease choice=""")
command = inputName.split(' ')
if command[0] == 'reboot':
main.downtime()
elif command[0] == 'service_stop':
serviceName = command[1].replace('-', '')
main.service_stop(serviceName)
elif command[0] == 'service_start':
serviceName = command[1].replace('-', '')
main.service_start(serviceName)
elif command[0] == 'customer_stop':
serviceName = command[1].replace('-', '')
main.customer_stop(serviceName)
elif command[0] == 'customer_start':
serviceName = command[1].replace('-', '')
main.customer_start(serviceName)
elif command[0] == 'cpu_limit_start':
processName = command[1].replace('-', '')
rate = command[2].replace('-', '')
main.cpu_limit_start(processName, rate)
elif command[0] == 'cpu_limit_stop':
main.cpu_limit_stop()
elif command[0] == 'cpu_nervous':
rate = command[1].replace('-', '')
main.cpu_nervous(rate)
elif command[0] == 'mem_leak':
main.mem_leak()
elif command[0] == 'process_leak':
main.process_leak()
elif command[0] == 'thread_lead':
main.thread_lead()
elif command[0] == 'disk_full_all':
main.disk_full_all()
elif command[0] == 'disk_full_all_recover':
main.disk_full_all_recover()
elif command[0] == 'disk_full_customer':
filename = command[1].replace('-', '')
d = command[2].replace('-', '')
main.disk_full_customer(filename, d)
elif command[0] == 'disk_slow':
s = command[1].replace('-', '')
g = command[2].replace('-', '')
se = command[3].replace('-', '')
main.disk_slow(s, g, se)
elif command[0] == 'network_delay':
m = command[1].replace('-', '')
main.network_delay(m)
elif command[0] == 'network_delay_stop':
m = command[1].replace('-', '')
main.stop_network_delay(m)
elif command[0] == 'network_wave_delay':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.network_wave_delay(s, e)
elif command[0] == 'network_wave_delay_stop':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.stop_network_delay(s, e)
elif command[0] == 'network_limit':
k = command[1].replace('-', '')
main.network_limit(k)
elif command[0] == 'network_limit_stop':
k = command[1].replace('-', '')
main.stop_network_limit(k)
elif command[0] == 'network_package_corrupt':
m = command[1].replace('-', '')
main.network_package_corrupt(m)
elif command[0] == 'network_package_corrupt_stop':
m = command[1].replace('-', '')
main.stop_network_package_corrupt(m)
elif command[0] == 'network_package_lost':
m = command[1].replace('-', '')
main.network_package_lost(m)
elif command[0] == 'network_package_lost_stop':
m = command[1].replace('-', '')
main.stop_network_package_lost(m)
elif command[0] == 'network_package_duplicate_stop':
m = command[1].replace('-', '')
main.stop_network_package_duplicate(m)
elif command[0] == 'network_package_duplicate':
m = command[1].replace('-', '')
main.network_package_duplicate(m)
elif command[0] == 'ulimit':
m = command[1].replace('-', '')
main.ulimit(m)
elif command[0] == 'apache_maxclients':
main.apache_maxclients()
elif command[0] == 'exit':
break
else:
print 'order error'
time.sleep(2)
except Exception, e:
print e
auth : wenshan
time :
version : v1.0.0
"""
import main
import time
if __name__ == "__main__":
while True:
try:
inputName = raw_input("""
1.reboot :reboot the PC.
2.service_stop -name :stop service.
service_start -name :start service.
3.customer_stop -name :run customer command.
customer_start -name :run customer command.
4.cpu_limit_start -processName -rate
:limit the process under the rate.
cpu_limit_stop :stop the service cpulimt.
cpu_nervous -rate :cpu nervous,havn't recover funtion.
5.mem_leak :mem nervous,havn't recover funtion.
6.process_leak :loop create process.havn't recover funtion.
thread_lead :loop create thread.havn't recover funtion.
7.disk_full_all :fill all disk.
disk_full_all_recover :recover
disk_full_customer -filename -mbytes
:create a file.havn't recover funtion.
disk_slow -swapname -gbytes -seconds
:disk slow.havn't recover funtion.
8.network_delay -msdelaytime :delay the network
network_delay_stop -msDelayTime :recover
network_wave_delay -startMsDelayTime -endMsDelayTime
:wave delay
network_wave_delay_stop -startMsDelayTime -endMsDelayTime
:recover
network_limit -kbit :limit network
network_limit_stop -kbit :recover
network_package_corrupt -rate :package corrupt
network_package_corrupt_stop -rate
:recover
network_package_lost -rate :package lost
network_package_lost_stop -rate :recover
network_package_duplicate -rate :package duplicate
network_package_duplicate_stop -rate
:recover
9.ulimit -number :limit the file handler
apache_maxclients :change the apache max clients
10.exit\n\nplease choice=""")
command = inputName.split(' ')
if command[0] == 'reboot':
main.downtime()
elif command[0] == 'service_stop':
serviceName = command[1].replace('-', '')
main.service_stop(serviceName)
elif command[0] == 'service_start':
serviceName = command[1].replace('-', '')
main.service_start(serviceName)
elif command[0] == 'customer_stop':
serviceName = command[1].replace('-', '')
main.customer_stop(serviceName)
elif command[0] == 'customer_start':
serviceName = command[1].replace('-', '')
main.customer_start(serviceName)
elif command[0] == 'cpu_limit_start':
processName = command[1].replace('-', '')
rate = command[2].replace('-', '')
main.cpu_limit_start(processName, rate)
elif command[0] == 'cpu_limit_stop':
main.cpu_limit_stop()
elif command[0] == 'cpu_nervous':
rate = command[1].replace('-', '')
main.cpu_nervous(rate)
elif command[0] == 'mem_leak':
main.mem_leak()
elif command[0] == 'process_leak':
main.process_leak()
elif command[0] == 'thread_lead':
main.thread_lead()
elif command[0] == 'disk_full_all':
main.disk_full_all()
elif command[0] == 'disk_full_all_recover':
main.disk_full_all_recover()
elif command[0] == 'disk_full_customer':
filename = command[1].replace('-', '')
d = command[2].replace('-', '')
main.disk_full_customer(filename, d)
elif command[0] == 'disk_slow':
s = command[1].replace('-', '')
g = command[2].replace('-', '')
se = command[3].replace('-', '')
main.disk_slow(s, g, se)
elif command[0] == 'network_delay':
m = command[1].replace('-', '')
main.network_delay(m)
elif command[0] == 'network_delay_stop':
m = command[1].replace('-', '')
main.stop_network_delay(m)
elif command[0] == 'network_wave_delay':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.network_wave_delay(s, e)
elif command[0] == 'network_wave_delay_stop':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.stop_network_delay(s, e)
elif command[0] == 'network_limit':
k = command[1].replace('-', '')
main.network_limit(k)
elif command[0] == 'network_limit_stop':
k = command[1].replace('-', '')
main.stop_network_limit(k)
elif command[0] == 'network_package_corrupt':
m = command[1].replace('-', '')
main.network_package_corrupt(m)
elif command[0] == 'network_package_corrupt_stop':
m = command[1].replace('-', '')
main.stop_network_package_corrupt(m)
elif command[0] == 'network_package_lost':
m = command[1].replace('-', '')
main.network_package_lost(m)
elif command[0] == 'network_package_lost_stop':
m = command[1].replace('-', '')
main.stop_network_package_lost(m)
elif command[0] == 'network_package_duplicate_stop':
m = command[1].replace('-', '')
main.stop_network_package_duplicate(m)
elif command[0] == 'network_package_duplicate':
m = command[1].replace('-', '')
main.network_package_duplicate(m)
elif command[0] == 'ulimit':
m = command[1].replace('-', '')
main.ulimit(m)
elif command[0] == 'apache_maxclients':
main.apache_maxclients()
elif command[0] == 'exit':
break
else:
print 'order error'
time.sleep(2)
except Exception, e:
print e
相关文章推荐
- Asp.Net权限管理系统 专用代码生成工具(DDBuildTools) 1.1.0 下载
- UnityTestTools测试工具
- Asp.Net权限管理系统 专用代码生成工具(DDBuildTools) 1.1.0
- Linux网络流量控制工具—Netem(可用于网络故障注入)
- 注入工具的原理和开发
- [原创]试用榕哥新工具WIS和WED的一次注入实例
- 自己做了一个单元测试的小工具---EasyTest.net
- 推荐一款自动编译工具Visual Build Professional和一本书《Coder To Developer -- Tools and Strategies for Delivering Your Software》
- 域安全通道实用工具nltest.exe的使用简介(下)
- 在PB中如何使用软件测试工具rational teamtest
- ISA Server 的故障排除工具(2)
- 论坛转帖专用工具源代码
- Windows TCP/IP 故障排除工具
- ISA Server 的故障排除工具(4)
- 注入工具的原理和开发
- 转 推荐一个不错的VS.NET集成单元测试工具TestDriven.NET
- 推荐一个不错的VS.NET集成单元测试工具TestDriven.NET
- Ten Must-Have Tools Every Developer Should Download Now(十个开发人员必须下载的工具,英文原版)
- [转载]Python实现ASP+ACCESS注入的工具源代码
- 单元测试工具比拼:JTest vs Agitator