├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── captures └── .placeholder ├── config ├── config.1110.py ├── config.1404.py ├── config.1610.py ├── config.debian2.py ├── config.win81.py ├── config.win95.py ├── config.winXP.py ├── ssh.key ├── ssh.key.pub └── tcp-newreno.xml ├── coordinator ├── coordinator.py ├── generators.py ├── manipulations.py ├── stateMapper.py └── strategyGenerator.py ├── docs ├── model_based_search_algorithm.tex ├── state_machine_inference_algorithm.tex └── strategy_generation_algorithm.txt ├── executor ├── libs │ ├── Crypto │ │ ├── Cipher │ │ │ ├── AES.py │ │ │ ├── ARC2.py │ │ │ ├── ARC4.py │ │ │ ├── Blowfish.py │ │ │ ├── CAST.py │ │ │ ├── DES.py │ │ │ ├── DES3.py │ │ │ ├── PKCS1_OAEP.py │ │ │ ├── PKCS1_v1_5.py │ │ │ ├── XOR.py │ │ │ ├── _AES.so │ │ │ ├── _ARC2.so │ │ │ ├── _ARC4.so │ │ │ ├── _Blowfish.so │ │ │ ├── _CAST.so │ │ │ ├── _DES.so │ │ │ ├── _DES3.so │ │ │ ├── _XOR.so │ │ │ ├── __init__.py │ │ │ └── blockalgo.py │ │ ├── Hash │ │ │ ├── HMAC.py │ │ │ ├── MD2.py │ │ │ ├── MD4.py │ │ │ ├── MD5.py │ │ │ ├── RIPEMD.py │ │ │ ├── SHA.py │ │ │ ├── SHA224.py │ │ │ ├── SHA256.py │ │ │ ├── SHA384.py │ │ │ ├── SHA512.py │ │ │ ├── _MD2.so │ │ │ ├── _MD4.so │ │ │ ├── _RIPEMD160.so │ │ │ ├── _SHA224.so │ │ │ ├── _SHA256.so │ │ │ ├── _SHA384.so │ │ │ ├── _SHA512.so │ │ │ ├── __init__.py │ │ │ └── hashalgo.py │ │ ├── Protocol │ │ │ ├── AllOrNothing.py │ │ │ ├── Chaffing.py │ │ │ ├── KDF.py │ │ │ └── __init__.py │ │ ├── PublicKey │ │ │ ├── DSA.py │ │ │ ├── ElGamal.py │ │ │ ├── RSA.py │ │ │ ├── _DSA.py │ │ │ ├── _RSA.py │ │ │ ├── __init__.py │ │ │ ├── _fastmath.so │ │ │ ├── _slowmath.py │ │ │ └── pubkey.py │ │ ├── Random │ │ │ ├── Fortuna │ │ │ │ ├── FortunaAccumulator.py │ │ │ │ ├── FortunaGenerator.py │ │ │ │ ├── SHAd256.py │ │ │ │ └── __init__.py │ │ │ ├── OSRNG │ │ │ │ ├── __init__.py │ │ │ │ ├── fallback.py │ │ │ │ ├── nt.py │ │ │ │ ├── posix.py │ │ │ │ └── rng_base.py │ │ │ ├── _UserFriendlyRNG.py │ │ │ ├── __init__.py │ │ │ └── random.py │ │ ├── SelfTest │ │ │ ├── Cipher │ │ │ │ ├── __init__.py │ │ │ │ ├── common.py │ │ │ │ ├── test_AES.py │ │ │ │ ├── test_ARC2.py │ │ │ │ ├── test_ARC4.py │ │ │ │ ├── test_Blowfish.py │ │ │ │ ├── test_CAST.py │ │ │ │ ├── test_DES.py │ │ │ │ ├── test_DES3.py │ │ │ │ ├── test_XOR.py │ │ │ │ ├── test_pkcs1_15.py │ │ │ │ └── test_pkcs1_oaep.py │ │ │ ├── Hash │ │ │ │ ├── __init__.py │ │ │ │ ├── common.py │ │ │ │ ├── test_HMAC.py │ │ │ │ ├── test_MD2.py │ │ │ │ ├── test_MD4.py │ │ │ │ ├── test_MD5.py │ │ │ │ ├── test_RIPEMD.py │ │ │ │ ├── test_SHA.py │ │ │ │ ├── test_SHA224.py │ │ │ │ ├── test_SHA256.py │ │ │ │ ├── test_SHA384.py │ │ │ │ └── test_SHA512.py │ │ │ ├── Protocol │ │ │ │ ├── __init__.py │ │ │ │ ├── test_AllOrNothing.py │ │ │ │ ├── test_KDF.py │ │ │ │ ├── test_chaffing.py │ │ │ │ └── test_rfc1751.py │ │ │ ├── PublicKey │ │ │ │ ├── __init__.py │ │ │ │ ├── test_DSA.py │ │ │ │ ├── test_ElGamal.py │ │ │ │ ├── test_RSA.py │ │ │ │ └── test_importKey.py │ │ │ ├── Random │ │ │ │ ├── Fortuna │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_FortunaAccumulator.py │ │ │ │ │ ├── test_FortunaGenerator.py │ │ │ │ │ └── test_SHAd256.py │ │ │ │ ├── OSRNG │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_fallback.py │ │ │ │ │ ├── test_generic.py │ │ │ │ │ ├── test_nt.py │ │ │ │ │ ├── test_posix.py │ │ │ │ │ └── test_winrandom.py │ │ │ │ ├── __init__.py │ │ │ │ ├── test__UserFriendlyRNG.py │ │ │ │ ├── test_random.py │ │ │ │ └── test_rpoolcompat.py │ │ │ ├── Signature │ │ │ │ ├── __init__.py │ │ │ │ ├── test_pkcs1_15.py │ │ │ │ └── test_pkcs1_pss.py │ │ │ ├── Util │ │ │ │ ├── __init__.py │ │ │ │ ├── test_Counter.py │ │ │ │ ├── test_asn1.py │ │ │ │ ├── test_number.py │ │ │ │ └── test_winrandom.py │ │ │ ├── __init__.py │ │ │ └── st_common.py │ │ ├── Signature │ │ │ ├── PKCS1_PSS.py │ │ │ ├── PKCS1_v1_5.py │ │ │ └── __init__.py │ │ ├── Util │ │ │ ├── Counter.py │ │ │ ├── RFC1751.py │ │ │ ├── __init__.py │ │ │ ├── _counter.so │ │ │ ├── _number_new.py │ │ │ ├── asn1.py │ │ │ ├── number.py │ │ │ ├── py21compat.py │ │ │ ├── py3compat.py │ │ │ ├── randpool.py │ │ │ ├── strxor.so │ │ │ └── winrandom.py │ │ ├── __init__.py │ │ └── pct_warnings.py │ ├── ecdsa │ │ ├── __init__.py │ │ ├── _version.py │ │ ├── curves.py │ │ ├── der.py │ │ ├── ecdsa.py │ │ ├── ellipticcurve.py │ │ ├── keys.py │ │ ├── numbertheory.py │ │ ├── rfc6979.py │ │ ├── six.py │ │ ├── test_pyecdsa.py │ │ └── util.py │ ├── paramiko │ │ ├── __init__.py │ │ ├── _version.py │ │ ├── _winapi.py │ │ ├── agent.py │ │ ├── auth_handler.py │ │ ├── ber.py │ │ ├── buffered_pipe.py │ │ ├── channel.py │ │ ├── client.py │ │ ├── common.py │ │ ├── compress.py │ │ ├── config.py │ │ ├── dsskey.py │ │ ├── ecdsakey.py │ │ ├── file.py │ │ ├── hostkeys.py │ │ ├── kex_gex.py │ │ ├── kex_group1.py │ │ ├── kex_group14.py │ │ ├── kex_gss.py │ │ ├── message.py │ │ ├── packet.py │ │ ├── pipe.py │ │ ├── pkey.py │ │ ├── primes.py │ │ ├── proxy.py │ │ ├── py3compat.py │ │ ├── resource.py │ │ ├── rsakey.py │ │ ├── server.py │ │ ├── sftp.py │ │ ├── sftp_attr.py │ │ ├── sftp_client.py │ │ ├── sftp_file.py │ │ ├── sftp_handle.py │ │ ├── sftp_server.py │ │ ├── sftp_si.py │ │ ├── ssh_exception.py │ │ ├── ssh_gss.py │ │ ├── transport.py │ │ ├── util.py │ │ └── win_pageant.py │ ├── scapy │ │ ├── __init__.py │ │ ├── all.py │ │ ├── ansmachine.py │ │ ├── arch │ │ │ ├── __init__.py │ │ │ ├── bsd.py │ │ │ ├── common.py │ │ │ ├── linux.py │ │ │ ├── pcapdnet.py │ │ │ ├── solaris.py │ │ │ ├── unix.py │ │ │ ├── windows │ │ │ │ └── __init__.py │ │ │ └── winpcapy.py │ │ ├── as_resolvers.py │ │ ├── asn1 │ │ │ ├── __init__.py │ │ │ ├── asn1.py │ │ │ ├── ber.py │ │ │ └── mib.py │ │ ├── asn1fields.py │ │ ├── asn1packet.py │ │ ├── automaton.py │ │ ├── autorun.py │ │ ├── base_classes.py │ │ ├── config.py │ │ ├── contrib │ │ │ ├── HomePlugAV.py │ │ │ ├── __init__.py │ │ │ ├── avs.py │ │ │ ├── bgp.py │ │ │ ├── carp.py │ │ │ ├── cdp.py │ │ │ ├── chdlc.py │ │ │ ├── coap.py │ │ │ ├── dtp.py │ │ │ ├── eigrp.py │ │ │ ├── etherip.py │ │ │ ├── gsm_um.py │ │ │ ├── gtp.py │ │ │ ├── icmp_extensions.py │ │ │ ├── igmp.py │ │ │ ├── igmpv3.py │ │ │ ├── ikev2.py │ │ │ ├── isis.py │ │ │ ├── ldp.py │ │ │ ├── modbus.py │ │ │ ├── mpls.py │ │ │ ├── nsh.py │ │ │ ├── openflow.py │ │ │ ├── openflow3.py │ │ │ ├── ospf.py │ │ │ ├── pnio.py │ │ │ ├── pnio_rtc.py │ │ │ ├── ppi.py │ │ │ ├── ppi_cace.py │ │ │ ├── ppi_geotag.py │ │ │ ├── ripng.py │ │ │ ├── rsvp.py │ │ │ ├── sebek.py │ │ │ ├── send.py │ │ │ ├── skinny.py │ │ │ ├── spbm.py │ │ │ ├── ubberlogger.py │ │ │ ├── vqp.py │ │ │ ├── vtp.py │ │ │ └── wpa_eapol.py │ │ ├── dadict.py │ │ ├── data.py │ │ ├── error.py │ │ ├── fields.py │ │ ├── layers │ │ │ ├── __init__.py │ │ │ ├── all.py │ │ │ ├── bluetooth.py │ │ │ ├── clns.py │ │ │ ├── dhcp.py │ │ │ ├── dhcp6.py │ │ │ ├── dns.py │ │ │ ├── dot11.py │ │ │ ├── gprs.py │ │ │ ├── hsrp.py │ │ │ ├── inet.py │ │ │ ├── inet6.py │ │ │ ├── ipsec.py │ │ │ ├── ir.py │ │ │ ├── isakmp.py │ │ │ ├── l2.py │ │ │ ├── l2tp.py │ │ │ ├── llmnr.py │ │ │ ├── lltd.py │ │ │ ├── mgcp.py │ │ │ ├── mobileip.py │ │ │ ├── netbios.py │ │ │ ├── netflow.py │ │ │ ├── ntp.py │ │ │ ├── pflog.py │ │ │ ├── ppp.py │ │ │ ├── radius.py │ │ │ ├── rip.py │ │ │ ├── rtp.py │ │ │ ├── sctp.py │ │ │ ├── skinny.py │ │ │ ├── smb.py │ │ │ ├── snmp.py │ │ │ ├── tftp.py │ │ │ ├── tls │ │ │ │ ├── __init__.py │ │ │ │ ├── cert.py │ │ │ │ └── crypto │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── curves.py │ │ │ │ │ └── pkcs1.py │ │ │ ├── vrrp.py │ │ │ ├── vxlan.py │ │ │ └── x509.py │ │ ├── main.py │ │ ├── modules │ │ │ ├── __init__.py │ │ │ ├── nmap.py │ │ │ ├── p0f.py │ │ │ ├── queso.py │ │ │ └── voip.py │ │ ├── packet.py │ │ ├── pipetool.py │ │ ├── plist.py │ │ ├── pton_ntop.py │ │ ├── route.py │ │ ├── route6.py │ │ ├── scapypipes.py │ │ ├── sendrecv.py │ │ ├── supersocket.py │ │ ├── themes.py │ │ ├── tools │ │ │ ├── UTscapy.py │ │ │ ├── __init__.py │ │ │ └── check_asdis.py │ │ ├── utils.py │ │ ├── utils6.py │ │ └── volatile.py │ └── spur │ │ ├── __init__.py │ │ ├── errors.py │ │ ├── files.py │ │ ├── io.py │ │ ├── local.py │ │ ├── results.py │ │ ├── ssh.py │ │ └── tempdir.py ├── manage_vms.py ├── network_setup.py ├── run.py └── test.py ├── files ├── bigfile.gz └── smallfile.gz ├── logs └── .placeholder ├── monitor ├── Makefile ├── algorithm.h ├── classic.cc ├── classic.h ├── iface.cc ├── iface.h ├── monitor.cc ├── monitor.h ├── proto.h ├── tcp.cc ├── tcp.h ├── tracker.cc └── tracker.h ├── proxy ├── Makefile ├── args.cc ├── args.h ├── attacker.cc ├── attacker.h ├── checksums.c ├── checksums.h ├── control.cc ├── control.h ├── csv.cc ├── csv.h ├── iface.cc ├── iface.h ├── limit.sh ├── proto.h ├── proxy.cc ├── proxy.h ├── sndcmd.cc ├── tcp.cc ├── tcp.h └── tcpModifiers.cc ├── state_searcher ├── Makefile ├── include │ ├── config.h │ ├── graph.h │ ├── rapidxml-1.13 │ │ ├── license.txt │ │ ├── manual.html │ │ ├── rapidxml.hpp │ │ ├── rapidxml_iterators.hpp │ │ ├── rapidxml_print.hpp │ │ └── rapidxml_utils.hpp │ ├── searcher.h │ └── string-operations.h ├── lib │ ├── graph.cpp │ └── searcher.cpp └── tool │ ├── Makefile │ └── main.cpp ├── utils ├── analysisSummary.py ├── formatter.py ├── qv.py ├── timingGraph.gnu ├── timingGraph.py └── viewer.py └── vms └── placeholder /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated files 2 | *.ck 3 | /tmp/*.log.* 4 | /proxy/sndcmd 5 | /proxy/proxy 6 | /monitor/sndcmd 7 | /monitor/monitor 8 | /state_searcher/bin/* 9 | executor/libs/scapy/VERSION 10 | /config/config.py 11 | 12 | # Temporary 13 | *~ 14 | .Trash-* 15 | 16 | # C++ 17 | *.o 18 | *.out 19 | 20 | # Python 21 | __pycache__/ 22 | *.py[cod] 23 | *$py.class 24 | 25 | # Java 26 | *.class 27 | 28 | # LaTeX 29 | *.gz 30 | *.aux 31 | *.dvi 32 | *.log 33 | *.blg 34 | *.bbl 35 | *.toc 36 | *.lof 37 | *.lot 38 | *.out 39 | *.nav 40 | *.snm 41 | 42 | # VMs 43 | *.qcow2 44 | *.sav 45 | *.vdmk 46 | *.vdi 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | * Copyright (c) 2017, Samuel Jero, Endadul Hoque, Cristina Nita-Rotaru 2 | * All rights reserved. 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the names of the contributors, nor their associated universities 12 | * or organizations may be used to endorse or promote products derived from 13 | * this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 24 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Author: Samuel Jero 3 | ############################################################################### 4 | all: 5 | make -C proxy 6 | make -C monitor 7 | make -C state_searcher 8 | 9 | clean: 10 | make -C proxy clean 11 | make -C monitor clean 12 | make -C state_searcher clean 13 | -------------------------------------------------------------------------------- /captures/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/captures/.placeholder -------------------------------------------------------------------------------- /config/config.1110.py: -------------------------------------------------------------------------------- 1 | # SDN Testing Config File 2 | # Python syntax 3 | import os 4 | import socket 5 | 6 | #Global 7 | system_home = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] 8 | logs_loc = system_home + "/logs/inst{instance}.log" 9 | currently_testing = "Ubuntu 11.10" 10 | protocol = "TCP" 11 | 12 | #Captures 13 | do_capture = True 14 | captures_loc = system_home + "/captures/{tm}-e{exe}.dmp" 15 | captures_time_str = "%Y-%m-%d-%H-%M-%S" 16 | capture_cmd = "tcpdump -i eth2 -s84 -w - tcp > /root/capture.dmp" 17 | capture_kill_cmd = "pkill tcpdump" 18 | 19 | 20 | #Baselining 21 | stat_baseline_nrounds = 20 22 | 23 | #Proxy 24 | proxy_com_port = 1026 25 | proxy_cmd = "/root/proxy/proxy -i eth1 -i eth2 -v -p {port}" 26 | limit_cmd = "/root/proxy/limit.sh" 27 | proxy_kill_cmd = "pkill proxy" 28 | 29 | #Monitor 30 | monitor_com_port = 4444 31 | monitor_cmd = "/root/monitor/monitor -i eth1 -i eth2 -v -p {port} -o {proxy}:{proxyport}" 32 | monitor_kill_cmd = "pkill monitor" 33 | 34 | #Servers 35 | server_start_cmd = "service apache2 restart" 36 | background_server_config = "" 37 | target_server_ip = "10.0.3.3" 38 | background_server_ip = "10.0.3.4" 39 | 40 | #Clients 41 | background_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.4/bigfile" 42 | main_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.3/bigfile" 43 | target_client_ip = "10.0.3.1" 44 | background_client_ip = "10.0.3.2" 45 | 46 | #Coordinator 47 | coordinator_port = 3333 48 | failed_retries = 1 49 | coord_strategy_generation_algorithm = "StateBased" 50 | coord_strategy_generation_state_machine_file = system_home + "/config/tcp-newreno.xml" 51 | coord_strategy_generation_state_machine_search = "cwnd" 52 | coord_checkpoint_file = system_home + "/logs/coord.ck" 53 | coord_log = system_home + "/logs/coord.log" 54 | coord_results_log = system_home + "/logs/results.log" 55 | email_on_system_fail = False 56 | dst_email_address = "" 57 | src_email_address = "cctester@" + socket.getfqdn() 58 | 59 | #Test 60 | max_time = 60 61 | transfer_size = 100*1024*1024 62 | transfer_multiple = 0.7 63 | test_max_idle = 10 64 | #test_results_avg = 65 | #test_results_stddev = 66 | 67 | #VM Section 68 | vm_path = system_home + "/vms/" 69 | master_name = "/ubuntu-1404-master.qcow2" 70 | vm_name_bases = ["client", "client","ubuntu1110-server","server", "tc", "track"] 71 | vm_net = [["tap-n{n}-b1-h0"],["tap-n{n}-b1-h1"],["tap-n{n}-b3-h0"],["tap-n{n}-b2-h1"],["tap-n{n}-b1-h2","tap-n{n}-b2-h2"], ["tap-n{n}-b3-h1","tap-n{n}-b2-h0"]] 72 | vm_has_ssh = [True,True,True,True,True,True] 73 | vm_can_ping = [True,True,True,True,True,True] 74 | vm_cores = ["2","2","2","2","4","2"] 75 | vm_user = "root" 76 | vm_ip_base = "10.0.1.{0}" 77 | vm_ram = "2048" 78 | vm_telnet_base = 10100 79 | vm_vnc_base = 1 80 | vm_ssh_key = system_home + "/config/ssh.key" 81 | vm_replace_data = True 82 | -------------------------------------------------------------------------------- /config/config.1404.py: -------------------------------------------------------------------------------- 1 | # SDN Testing Config File 2 | # Python syntax 3 | import os 4 | import socket 5 | 6 | #Global 7 | system_home = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] 8 | logs_loc = system_home + "/logs/inst{instance}.log" 9 | currently_testing = "Ubuntu 14.04" 10 | protocol = "TCP" 11 | 12 | #Captures 13 | do_capture = True 14 | captures_loc = system_home + "/captures/{tm}-e{exe}.dmp" 15 | captures_time_str = "%Y-%m-%d-%H-%M-%S" 16 | capture_cmd = "tcpdump -i eth2 -s84 -w - tcp > /root/capture.dmp" 17 | capture_kill_cmd = "pkill tcpdump" 18 | 19 | 20 | #Baselining 21 | stat_baseline_nrounds = 20 22 | 23 | #Proxy 24 | proxy_com_port = 1026 25 | proxy_cmd = "/root/proxy/proxy -i eth1 -i eth2 -v -p {port}" 26 | limit_cmd = "/root/proxy/limit.sh" 27 | proxy_kill_cmd = "pkill proxy" 28 | 29 | #Monitor 30 | monitor_com_port = 4444 31 | monitor_cmd = "/root/monitor/monitor -i eth1 -i eth2 -v -p {port} -o {proxy}:{proxyport}" 32 | monitor_kill_cmd = "pkill monitor" 33 | 34 | #Servers 35 | server_start_cmd = "service apache2 restart" 36 | background_server_config = "" 37 | target_server_ip = "10.0.3.3" 38 | background_server_ip = "10.0.3.4" 39 | 40 | #Clients 41 | background_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.4/bigfile" 42 | main_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.3/bigfile" 43 | target_client_ip = "10.0.3.1" 44 | background_client_ip = "10.0.3.2" 45 | 46 | #Coordinator 47 | coordinator_port = 3333 48 | failed_retries = 1 49 | coord_strategy_generation_algorithm = "StateBased" 50 | coord_strategy_generation_state_machine_file = system_home + "/config/tcp-newreno.xml" 51 | coord_strategy_generation_state_machine_search = "cwnd" 52 | coord_checkpoint_file = system_home + "/logs/coord.ck" 53 | coord_log = system_home + "/logs/coord.log" 54 | coord_results_log = system_home + "/logs/results.log" 55 | email_on_system_fail = False 56 | dst_email_address = "" 57 | src_email_address = "cctester@" + socket.getfqdn() 58 | 59 | #Test 60 | max_time = 60 61 | transfer_size = 100*1024*1024 62 | transfer_multiple = 0.7 63 | test_max_idle = 10 64 | #test_results_avg = 65 | #test_results_stddev = 66 | 67 | #VM Section 68 | vm_path = system_home + "/vms/" 69 | master_name = "/ubuntu-1404-master.qcow2" 70 | vm_name_bases = ["client", "client","server","server", "tc", "track"] 71 | vm_net = [["tap-n{n}-b1-h0"],["tap-n{n}-b1-h1"],["tap-n{n}-b3-h0"],["tap-n{n}-b2-h1"],["tap-n{n}-b1-h2","tap-n{n}-b2-h2"], ["tap-n{n}-b3-h1","tap-n{n}-b2-h0"]] 72 | vm_has_ssh = [True,True,True,True,True,True] 73 | vm_can_ping = [True,True,True,True,True,True] 74 | vm_cores = ["2","2","2","2","4","2"] 75 | vm_user = "root" 76 | vm_ip_base = "10.0.1.{0}" 77 | vm_ram = "2048" 78 | vm_telnet_base = 10100 79 | vm_vnc_base = 1 80 | vm_ssh_key = system_home + "/config/ssh.key" 81 | vm_replace_data = True 82 | -------------------------------------------------------------------------------- /config/config.1610.py: -------------------------------------------------------------------------------- 1 | # SDN Testing Config File 2 | # Python syntax 3 | import os 4 | import socket 5 | 6 | #Global 7 | system_home = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] 8 | logs_loc = system_home + "/logs/inst{instance}.log" 9 | currently_testing = "Ubuntu 16.10" 10 | protocol = "TCP" 11 | 12 | #Captures 13 | do_capture = True 14 | captures_loc = system_home + "/captures/{tm}-e{exe}.dmp" 15 | captures_time_str = "%Y-%m-%d-%H-%M-%S" 16 | capture_cmd = "tcpdump -i eth2 -s84 -w - tcp > /root/capture.dmp" 17 | capture_kill_cmd = "pkill tcpdump" 18 | 19 | 20 | #Baselining 21 | stat_baseline_nrounds = 20 22 | 23 | #Proxy 24 | proxy_com_port = 1026 25 | proxy_cmd = "/root/proxy/proxy -i eth1 -i eth2 -v -p {port}" 26 | limit_cmd = "/root/proxy/limit.sh" 27 | proxy_kill_cmd = "pkill proxy" 28 | 29 | #Monitor 30 | monitor_com_port = 4444 31 | monitor_cmd = "/root/monitor/monitor -i eth1 -i eth2 -v -p {port} -o {proxy}:{proxyport}" 32 | monitor_kill_cmd = "pkill monitor" 33 | 34 | #Servers 35 | server_start_cmd = "service apache2 restart" 36 | background_server_config = "" 37 | target_server_ip = "10.0.3.3" 38 | background_server_ip = "10.0.3.4" 39 | 40 | #Clients 41 | background_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.4/bigfile" 42 | main_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.3/bigfile" 43 | target_client_ip = "10.0.3.1" 44 | background_client_ip = "10.0.3.2" 45 | 46 | #Coordinator 47 | coordinator_port = 3333 48 | failed_retries = 1 49 | coord_strategy_generation_algorithm = "StateBased" 50 | coord_strategy_generation_state_machine_file = system_home + "/config/tcp-newreno.xml" 51 | coord_strategy_generation_state_machine_search = "cwnd" 52 | coord_checkpoint_file = system_home + "/logs/coord.ck" 53 | coord_log = system_home + "/logs/coord.log" 54 | coord_results_log = system_home + "/logs/results.log" 55 | email_on_system_fail = False 56 | dst_email_address = "" 57 | src_email_address = "cctester@" + socket.getfqdn() 58 | 59 | #Test 60 | max_time = 60 61 | transfer_size = 100*1024*1024 62 | transfer_multiple = 0.7 63 | test_max_idle = 10 64 | #test_results_avg = 65 | #test_results_stddev = 66 | 67 | #VM Section 68 | vm_path = system_home + "/vms/" 69 | master_name = "/ubuntu-1404-master.qcow2" 70 | vm_name_bases = ["client", "client","ubuntu1610-server","server", "tc", "track"] 71 | vm_net = [["tap-n{n}-b1-h0"],["tap-n{n}-b1-h1"],["tap-n{n}-b3-h0"],["tap-n{n}-b2-h1"],["tap-n{n}-b1-h2","tap-n{n}-b2-h2"], ["tap-n{n}-b3-h1","tap-n{n}-b2-h0"]] 72 | vm_has_ssh = [True,True,True,True,True,True] 73 | vm_can_ping = [True,True,True,True,True,True] 74 | vm_cores = ["2","2","2","2","4","2"] 75 | vm_user = "root" 76 | vm_ip_base = "10.0.1.{0}" 77 | vm_ram = "2048" 78 | vm_telnet_base = 10100 79 | vm_vnc_base = 1 80 | vm_ssh_key = system_home + "/config/ssh.key" 81 | vm_replace_data = True 82 | -------------------------------------------------------------------------------- /config/config.debian2.py: -------------------------------------------------------------------------------- 1 | # SDN Testing Config File 2 | # Python syntax 3 | import os 4 | import socket 5 | 6 | #Global 7 | system_home = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] 8 | logs_loc = system_home + "/logs/inst{instance}.log" 9 | currently_testing = "Debian 2.0" 10 | protocol = "TCP" 11 | 12 | #Captures 13 | do_capture = True 14 | captures_loc = system_home + "/captures/{tm}-e{exe}.dmp" 15 | captures_time_str = "%Y-%m-%d-%H-%M-%S" 16 | capture_cmd = "tcpdump -i eth2 -s84 -w - tcp > /root/capture.dmp" 17 | capture_kill_cmd = "pkill tcpdump" 18 | 19 | 20 | #Baselining 21 | stat_baseline_nrounds = 20 22 | 23 | #Proxy 24 | proxy_com_port = 1026 25 | proxy_cmd = "/root/proxy/proxy -i eth1 -i eth2 -v -p {port}" 26 | limit_cmd = "/root/proxy/limit.sh" 27 | proxy_kill_cmd = "pkill proxy" 28 | 29 | #Monitor 30 | monitor_com_port = 4444 31 | monitor_cmd = "/root/monitor/monitor -i eth1 -i eth2 -v -p {port} -o {proxy}:{proxyport}" 32 | monitor_kill_cmd = "pkill monitor" 33 | 34 | #Servers 35 | server_start_cmd = "service apache2 restart" 36 | background_server_config = "echo reno > /proc/sys/net/ipv4/tcp_congestion_control" 37 | target_server_ip = "10.0.3.3" 38 | background_server_ip = "10.0.3.4" 39 | 40 | #Clients 41 | background_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.4/smallfile" 42 | main_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.3/smallfile" 43 | target_client_ip = "10.0.3.1" 44 | background_client_ip = "10.0.3.2" 45 | 46 | #Coordinator 47 | coordinator_port = 3333 48 | failed_retries = 1 49 | coord_strategy_generation_algorithm = "StateBased" 50 | coord_strategy_generation_state_machine_file = system_home + "/config/tcp-newreno.xml" 51 | coord_strategy_generation_state_machine_search = "cwnd" 52 | coord_checkpoint_file = system_home + "/logs/coord.ck" 53 | coord_log = system_home + "/logs/coord.log" 54 | coord_results_log = system_home + "/logs/results.log" 55 | email_on_system_fail = False 56 | dst_email_address = "" 57 | src_email_address = "cctester@" + socket.getfqdn() 58 | 59 | #Test 60 | max_time = 90 61 | transfer_size = 10*1024*1024 62 | transfer_multiple = 0.7 63 | test_max_idle = 10 64 | #test_results_avg = 65 | #test_results_stddev = 66 | 67 | #VM Section 68 | vm_path = system_home + "/vms/" 69 | master_name = "/debian2-master.qcow2" 70 | vm_name_bases = ["client", "client","debian2-server","server", "tc", "track"] 71 | vm_net = [["tap-n{n}-b1-h0"],["tap-n{n}-b1-h1"],["tap-n{n}-b3-h0"],["tap-n{n}-b2-h1"],["tap-n{n}-b1-h2","tap-n{n}-b2-h2"], ["tap-n{n}-b3-h1","tap-n{n}-b2-h0"]] 72 | vm_has_ssh = [True,True,False,True,True,True] 73 | vm_can_ping = [True,True,False,True,True,True] 74 | vm_cores = ["2","2","1","1","4","2"] 75 | vm_user = "root" 76 | vm_ip_base = "10.0.1.{0}" 77 | vm_ram = "2048" 78 | vm_telnet_base = 10100 79 | vm_vnc_base = 1 80 | vm_ssh_key = system_home + "/config/ssh.key" 81 | vm_replace_data = True 82 | -------------------------------------------------------------------------------- /config/config.win81.py: -------------------------------------------------------------------------------- 1 | # SDN Testing Config File 2 | # Python syntax 3 | import os 4 | import socket 5 | 6 | #Global 7 | system_home = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] 8 | logs_loc = system_home + "/logs/inst{instance}.log" 9 | currently_testing = "Windows 8.1" 10 | protocol = "TCP" 11 | 12 | #Captures 13 | do_capture = True 14 | captures_loc = system_home + "/captures/{tm}-e{exe}.dmp" 15 | captures_time_str = "%Y-%m-%d-%H-%M-%S" 16 | capture_cmd = "tcpdump -i eth2 -s84 -w - tcp > /root/capture.dmp" 17 | capture_kill_cmd = "pkill tcpdump" 18 | 19 | 20 | #Baselining 21 | stat_baseline_nrounds = 20 22 | 23 | #Proxy 24 | proxy_com_port = 1026 25 | proxy_cmd = "/root/proxy/proxy -i eth1 -i eth2 -v -p {port}" 26 | limit_cmd = "/root/proxy/limit.sh" 27 | proxy_kill_cmd = "pkill proxy" 28 | 29 | #Monitor 30 | monitor_com_port = 4444 31 | monitor_cmd = "/root/monitor/monitor -i eth1 -i eth2 -v -p {port} -o {proxy}:{proxyport}" 32 | monitor_kill_cmd = "pkill monitor" 33 | 34 | #Servers 35 | server_start_cmd = "service apache2 restart" 36 | background_server_config = "" 37 | target_server_ip = "10.0.3.3" 38 | background_server_ip = "10.0.3.4" 39 | 40 | #Clients 41 | background_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.4/bigfile" 42 | main_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.3/bigfile" 43 | target_client_ip = "10.0.3.1" 44 | background_client_ip = "10.0.3.2" 45 | 46 | #Coordinator 47 | coordinator_port = 3333 48 | failed_retries = 1 49 | coord_strategy_generation_algorithm = "StateBased" 50 | coord_strategy_generation_state_machine_file = system_home + "/config/tcp-newreno.xml" 51 | coord_strategy_generation_state_machine_search = "cwnd" 52 | coord_checkpoint_file = system_home + "/logs/coord.ck" 53 | coord_log = system_home + "/logs/coord.log" 54 | coord_results_log = system_home + "/logs/results.log" 55 | email_on_system_fail = False 56 | dst_email_address = "" 57 | src_email_address = "cctester@" + socket.getfqdn() 58 | 59 | #Test 60 | max_time = 60 61 | transfer_size = 100*1024*1024 62 | transfer_multiple = 0.7 63 | test_max_idle = 10 64 | #test_results_avg = 65 | #test_results_stddev = 66 | 67 | #VM Section 68 | vm_path = system_home + "/vms/" 69 | master_name = "/ubuntu-1404-master.qcow2" 70 | vm_name_bases = ["client", "client","windows-8.1-server","server", "tc", "track"] 71 | vm_net = [["tap-n{n}-b1-h0"],["tap-n{n}-b1-h1"],["tap-n{n}-b3-h0"],["tap-n{n}-b2-h1"],["tap-n{n}-b1-h2","tap-n{n}-b2-h2"], ["tap-n{n}-b3-h1","tap-n{n}-b2-h0"]] 72 | vm_has_ssh = [True,True,False,True,True,True] 73 | vm_can_ping = [True,True,True,True,True,True] 74 | vm_cores = ["2","2","2","2","4","2"] 75 | vm_user = "root" 76 | vm_ip_base = "10.0.1.{0}" 77 | vm_ram = "2048" 78 | vm_telnet_base = 10100 79 | vm_vnc_base = 1 80 | vm_ssh_key = system_home + "/config/ssh.key" 81 | vm_replace_data = True 82 | -------------------------------------------------------------------------------- /config/config.win95.py: -------------------------------------------------------------------------------- 1 | # SDN Testing Config File 2 | # Python syntax 3 | import os 4 | import socket 5 | 6 | #Global 7 | system_home = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] 8 | logs_loc = system_home + "/logs/inst{instance}.log" 9 | currently_testing = "Windows 95" 10 | protocol = "TCP" 11 | 12 | #Captures 13 | do_capture = True 14 | captures_loc = system_home + "/captures/{tm}-e{exe}.dmp" 15 | captures_time_str = "%Y-%m-%d-%H-%M-%S" 16 | capture_cmd = "tcpdump -i eth2 -s84 -w - tcp > /root/capture.dmp" 17 | capture_kill_cmd = "pkill tcpdump" 18 | 19 | 20 | #Baselining 21 | stat_baseline_nrounds = 20 22 | 23 | #Proxy 24 | proxy_com_port = 1026 25 | proxy_cmd = "/root/proxy/proxy -i eth1 -i eth2 -v -p {port}" 26 | limit_cmd = "/root/proxy/limit.sh" 27 | proxy_kill_cmd = "pkill proxy" 28 | 29 | #Monitor 30 | monitor_com_port = 4444 31 | monitor_cmd = "/root/monitor/monitor -i eth1 -i eth2 -v -p {port} -o {proxy}:{proxyport}" 32 | monitor_kill_cmd = "pkill monitor" 33 | 34 | #Servers 35 | server_start_cmd = "service apache2 restart" 36 | background_server_config = "echo reno > /proc/sys/net/ipv4/tcp_congestion_control; echo 0 > /proc/sys/net/ipv4/tcp_sack; echo 0 > /proc/sys/net/ipv4/tcp_timestamps" 37 | target_server_ip = "10.0.3.3" 38 | background_server_ip = "10.0.3.4" 39 | 40 | #Clients 41 | background_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.4/smallfile" 42 | main_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.3/smallfile" 43 | target_client_ip = "10.0.3.1" 44 | background_client_ip = "10.0.3.2" 45 | 46 | #Coordinator 47 | coordinator_port = 3333 48 | failed_retries = 1 49 | coord_strategy_generation_algorithm = "StateBased" 50 | coord_strategy_generation_state_machine_file = system_home + "/config/tcp-newreno.xml" 51 | coord_strategy_generation_state_machine_search = "cwnd" 52 | coord_checkpoint_file = system_home + "/logs/coord.ck" 53 | coord_log = system_home + "/logs/coord.log" 54 | coord_results_log = system_home + "/logs/results.log" 55 | email_on_system_fail = False 56 | dst_email_address = "" 57 | src_email_address = "cctester@" + socket.getfqdn() 58 | 59 | #Test 60 | max_time = 120 61 | transfer_size = 10*1024*1024 62 | transfer_multiple = 0.8 63 | test_max_idle = 10 64 | #test_results_avg = 65 | #test_results_stddev = 66 | 67 | #VM Section 68 | vm_path = system_home + "/vms/" 69 | master_name = "/ubuntu-1404-master.qcow2" 70 | vm_name_bases = ["client", "client","windows95-server","server", "tc", "track"] 71 | vm_net = [["tap-n{n}-b1-h0"],["tap-n{n}-b1-h1"],["tap-n{n}-b3-h0"],["tap-n{n}-b2-h1"],["tap-n{n}-b1-h2","tap-n{n}-b2-h2"], ["tap-n{n}-b3-h1","tap-n{n}-b2-h0"]] 72 | vm_has_ssh = [True,True,False,True,True,True] 73 | vm_can_ping = [True,True,True,True,True,True] 74 | vm_cores = ["2","2","1","1","4","2"] 75 | vm_user = "root" 76 | vm_ip_base = "10.0.1.{0}" 77 | vm_ram = "2048" 78 | vm_telnet_base = 10100 79 | vm_vnc_base = 1 80 | vm_ssh_key = system_home + "/config/ssh.key" 81 | vm_replace_data = True 82 | -------------------------------------------------------------------------------- /config/config.winXP.py: -------------------------------------------------------------------------------- 1 | # SDN Testing Config File 2 | # Python syntax 3 | import os 4 | import socket 5 | 6 | #Global 7 | system_home = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] 8 | logs_loc = system_home + "/logs/inst{instance}.log" 9 | currently_testing = "Windows XP" 10 | protocol = "TCP" 11 | 12 | #Captures 13 | do_capture = True 14 | captures_loc = system_home + "/captures/{tm}-e{exe}.dmp" 15 | captures_time_str = "%Y-%m-%d-%H-%M-%S" 16 | capture_cmd = "tcpdump -i eth2 -s84 -w - tcp > /root/capture.dmp" 17 | capture_kill_cmd = "pkill tcpdump" 18 | 19 | 20 | #Baselining 21 | stat_baseline_nrounds = 20 22 | 23 | #Proxy 24 | proxy_com_port = 1026 25 | proxy_cmd = "/root/proxy/proxy -i eth1 -i eth2 -v -p {port}" 26 | limit_cmd = "/root/proxy/limit.sh" 27 | proxy_kill_cmd = "pkill proxy" 28 | 29 | #Monitor 30 | monitor_com_port = 4444 31 | monitor_cmd = "/root/monitor/monitor -i eth1 -i eth2 -v -p {port} -o {proxy}:{proxyport}" 32 | monitor_kill_cmd = "pkill monitor" 33 | 34 | #Servers 35 | server_start_cmd = "service apache2 restart" 36 | background_server_config = "" 37 | target_server_ip = "10.0.3.3" 38 | background_server_ip = "10.0.3.4" 39 | 40 | #Clients 41 | background_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.4/bigfile" 42 | main_client_cmd = "curl -o /dev/null -m {tm} http://10.0.3.3/bigfile" 43 | target_client_ip = "10.0.3.1" 44 | background_client_ip = "10.0.3.2" 45 | 46 | #Coordinator 47 | coordinator_port = 3333 48 | failed_retries = 1 49 | coord_strategy_generation_algorithm = "StateBased" 50 | coord_strategy_generation_state_machine_file = system_home + "/config/tcp-newreno.xml" 51 | coord_strategy_generation_state_machine_search = "cwnd" 52 | coord_checkpoint_file = system_home + "/logs/coord.ck" 53 | coord_log = system_home + "/logs/coord.log" 54 | coord_results_log = system_home + "/logs/results.log" 55 | email_on_system_fail = False 56 | dst_email_address = "" 57 | src_email_address = "cctester@" + socket.getfqdn() 58 | 59 | #Test 60 | max_time = 60 61 | transfer_size = 100*1024*1024 62 | transfer_multiple = 0.7 63 | test_max_idle = 10 64 | #test_results_avg = 65 | #test_results_stddev = 66 | 67 | #VM Section 68 | vm_path = system_home + "/vms/" 69 | master_name = "/ubuntu-1404-master.qcow2" 70 | vm_name_bases = ["client", "client","windowsXP-server","server", "tc", "track"] 71 | vm_net = [["tap-n{n}-b1-h0"],["tap-n{n}-b1-h1"],["tap-n{n}-b3-h0"],["tap-n{n}-b2-h1"],["tap-n{n}-b1-h2","tap-n{n}-b2-h2"], ["tap-n{n}-b3-h1","tap-n{n}-b2-h0"]] 72 | vm_has_ssh = [True,True,False,True,True,True] 73 | vm_can_ping = [True,True,True,True,True,True] 74 | vm_cores = ["2","2","2","2","4","2"] 75 | vm_user = "root" 76 | vm_ip_base = "10.0.1.{0}" 77 | vm_ram = "2048" 78 | vm_telnet_base = 10100 79 | vm_vnc_base = 1 80 | vm_ssh_key = system_home + "/config/ssh.key" 81 | vm_replace_data = True 82 | -------------------------------------------------------------------------------- /config/ssh.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEA0lA3KnRD0W+Z431GeaSoLwWiQ6qKEubvDYuJoreTnHqMIjKg 3 | gwv1FCCV5oTF2GI0h5wuVHYpEGYHVwyuEnDVGgDMordkIVzFMNr9Q66CsSaMaQ5X 4 | 1CB5dVBFAYSweq48bwkhLbrWFR0altExK/Um3Rg+t7u/a8iRpntHUOK7F0998Y4n 5 | Yg2IXqAY5J1/ZBZat4BX8o0MiZkj79U22ogYvMWv2L+VuYiDQ35vQEceotf8g2E9 6 | sdymMmVX2egKnBaNLMkUWWCfSjoW65tducMXvwkGkLwX2nZhn+pqYuUCSOiAHb9g 7 | 1dTG2N4+5/NiRIFgYDN4SPfdBu5yPzc6Y1DySQIDAQABAoIBAEMeLGzVC+uj1RW/ 8 | niUmAjJ3dtBndYcQwgutk3Ala+tNRLmJNKZ9w2n3+D7H8qfat27rzfFQgExmc0M5 9 | nbfu4GNbC/OF2WO4SooL6TWXVMgaSEcit67P6lMhGdShNvz/6/N3k2oXrUixsBGf 10 | kzS3GP8IRMO4HB/Ws3zQ7PKIWTLXrB+0FkYzirjSfjQdjzgrHT+jDLnjhOKv6++c 11 | SQtK0lNb7ljEJv407RvuDIIdIc5vxzdYpQA7G1WhINc7XeEIQfKR1COHupd/Beas 12 | Rh9nwa3DEhslxCXgSJIrDHhjOQDLyiAayub011OhBaXd5zNzkke5FeoBDd4x2m9Y 13 | goKltYECgYEA+Nz7PQqd3lpZdTSah3HFi2toVWNyOv30N+UZ4foN4PdkqJCZlcAk 14 | 0tJDiJZzR4Ua0kiBF/82RZgFsqWf3StR3+73REegv8/4h4LJ1daRGmNqzbCDRI6u 15 | sMiPAGU4DwmQjo51DOKClouLn/N9xTLyEoJoWHQpmAhrE3H0rFnlRJkCgYEA2Fg4 16 | zf15a5zVORszSbzY4H9dE3NzmSDzSYlzMW9YNR/9HeSR3KUkcPFecNCCpznrqCQ7 17 | telJvOukRPTgSGmhc0AZVbOTkAZcLWhHHGZJkBv/XE7cbyDJrjEeKDtxRnq1zQ+w 18 | a/4xffvTDVMUjKNdnOvKo6F1kVHlRUEjDQAm+TECgYAQFtFTX/VW48Z20mDPMubP 19 | nbEQHC7Na4+3cWNb/buZ+MSUNU0IpnR7AMcG9JsdW5ihUbiu4XwTwcFUjGqqdNuF 20 | O8DWtD7LR9nMgQMlhQq6hwTnqWrDKupWWZENOH4IUtj6rnEY1SgWLY1oWOifsCyA 21 | T9gJJ/Fsd9bcWfi0j9dHuQKBgHb0k09YNyIfmvIKbbn2t31BKqleSsqA3qSpigg9 22 | g8+6JhAAtN8QgqgDX31CeQSACX5rZdWRT3UsUCeGSagnRJm9PfDsi4+en6Jr+uW3 23 | rG0rp85WokgMTDiWU1Gl1ZP+NuZo4QWQQCBYjeR+sQbfcMKut74fMijUUe8xcJde 24 | ZQ+RAoGAbBxuKSh6mJo8+z8wOn5jYCNkc0OzlWVDq85L3gYRhrVFXTW40KWIKyxU 25 | RuTkIkRNpqjE9t/vE2xQb7FUc9Z1t8v0R14FRtaYI3brnASUetRmceJHxWbzF1nN 26 | aBgsfuyN4mrmZCActvkNKjwB/SfUPAa9KJp30YRyd8DI/tvj9eQ= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /config/ssh.key.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSUDcqdEPRb5njfUZ5pKgvBaJDqooS5u8Ni4mit5OceowiMqCDC/UUIJXmhMXYYjSHnC5UdikQZgdXDK4ScNUaAMyit2QhXMUw2v1DroKxJoxpDlfUIHl1UEUBhLB6rjxvCSEtutYVHRqW0TEr9SbdGD63u79ryJGme0dQ4rsXT33xjidiDYheoBjknX9kFlq3gFfyjQyJmSPv1TbaiBi8xa/Yv5W5iINDfm9ARx6i1/yDYT2x3KYyZVfZ6AqcFo0syRRZYJ9KOhbrm125wxe/CQaQvBfadmGf6mpi5QJI6IAdv2DV1MbY3j7n82JEgWBgM3hI990G7nI/NzpjUPJJ test@ds2.purdue.edu 2 | -------------------------------------------------------------------------------- /coordinator/manipulations.py: -------------------------------------------------------------------------------- 1 | #Samuel Jero 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | #Congestion Control Manipulations 4 | #These numbers are based on a test connection that transfers 10-11k packets 5 | 6 | #bytes_per_ack 7 | div_param_full = [ 8 | 1000, 9 | 500, 10 | 100, 11 | 10, 12 | # 1 13 | ] 14 | div_param_small = [ 15 | 1000, 16 | 10, 17 | ] 18 | div_param_template = "bpc={0!s}" 19 | 20 | 21 | #num_dups 22 | dup_param_full = [ 23 | 1, 24 | 2, 25 | 3, 26 | 10, 27 | 100, 28 | ] 29 | dup_param_small = [ 30 | 2, 31 | 10, 32 | ] 33 | dup_param_template = "num={0!s}" 34 | 35 | 36 | #burst_size 37 | burst_param_full = [ 38 | 2, 39 | 4, 40 | 10, 41 | 100, 42 | ] 43 | burst_param_small = [ 44 | 2, 45 | 10, 46 | ] 47 | burst_param_template = "num={0!s}" 48 | 49 | 50 | preack_param_full = [ 51 | 0, 52 | ] 53 | preack_param_small = [ 54 | 0, 55 | ] 56 | preack_param_template = "method=3&amt={0!s}" 57 | 58 | 59 | #amt_to_renege 60 | renege_param_full = [ 61 | 10, 62 | 100, 63 | 1000, 64 | 5000, 65 | ] 66 | renege_param_small = [ 67 | 1000, 68 | 100000, 69 | ] 70 | renege_param_template = "growth=1&amt={0!s}" 71 | 72 | 73 | selfish_receiver_actions = [ 74 | [ "DIV", div_param_template, div_param_full, div_param_small], 75 | [ "DUP", dup_param_template, dup_param_full, dup_param_small], 76 | [ "BURST", burst_param_template, burst_param_full, burst_param_small], 77 | [ "PREACK", preack_param_template, preack_param_full, preack_param_small], 78 | #[ "RENEGE", renege_param_template, renege_param_full, renege_param_small], 79 | ] 80 | 81 | 82 | length_full = [ 83 | 50000, 84 | 4000, 85 | 2000, 86 | 1000, 87 | 500, 88 | 100, 89 | 10, 90 | ] 91 | 92 | 93 | start_full = [ 94 | 0, 95 | 4, 96 | 100, 97 | 1000, 98 | 5000, 99 | ] 100 | 101 | 102 | chunk_start = [ 103 | 0, 104 | 2000, 105 | 4000, 106 | 6000, 107 | ] 108 | chunk_len = 2000 109 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_AES.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_AES.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_ARC2.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_ARC2.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_ARC4.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_ARC4.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_Blowfish.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_Blowfish.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_CAST.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_CAST.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_DES.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_DES.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_DES3.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_DES3.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Cipher/_XOR.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Cipher/_XOR.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/_MD2.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Hash/_MD2.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/_MD4.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Hash/_MD4.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/_RIPEMD160.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Hash/_RIPEMD160.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/_SHA224.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Hash/_SHA224.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/_SHA256.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Hash/_SHA256.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/_SHA384.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Hash/_SHA384.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/_SHA512.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Hash/_SHA512.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Hash/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # =================================================================== 4 | # The contents of this file are dedicated to the public domain. To 5 | # the extent that dedication to the public domain is not available, 6 | # everyone is granted a worldwide, perpetual, royalty-free, 7 | # non-exclusive license to exercise all rights associated with the 8 | # contents of this file for any purpose whatsoever. 9 | # No rights are reserved. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 12 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 15 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 16 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | # SOFTWARE. 19 | # =================================================================== 20 | 21 | """Hashing algorithms 22 | 23 | Hash functions take arbitrary binary strings as input, and produce a random-like output 24 | of fixed size that is dependent on the input; it should be practically infeasible 25 | to derive the original input data given only the hash function's 26 | output. In other words, the hash function is *one-way*. 27 | 28 | It should also not be practically feasible to find a second piece of data 29 | (a *second pre-image*) whose hash is the same as the original message 30 | (*weak collision resistance*). 31 | 32 | Finally, it should not be feasible to find two arbitrary messages with the 33 | same hash (*strong collision resistance*). 34 | 35 | The output of the hash function is called the *digest* of the input message. 36 | In general, the security of a hash function is related to the length of the 37 | digest. If the digest is *n* bits long, its security level is roughly comparable 38 | to the the one offered by an *n/2* bit encryption algorithm. 39 | 40 | Hash functions can be used simply as a integrity check, or, in 41 | association with a public-key algorithm, can be used to implement 42 | digital signatures. 43 | 44 | The hashing modules here all support the interface described in `PEP 45 | 247`_ , "API for Cryptographic Hash Functions". 46 | 47 | .. _`PEP 247` : http://www.python.org/dev/peps/pep-0247/ 48 | 49 | :undocumented: _MD2, _MD4, _RIPEMD160, _SHA224, _SHA256, _SHA384, _SHA512 50 | """ 51 | 52 | __all__ = ['HMAC', 'MD2', 'MD4', 'MD5', 'RIPEMD', 'SHA', 53 | 'SHA224', 'SHA256', 'SHA384', 'SHA512'] 54 | __revision__ = "$Id$" 55 | 56 | 57 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Protocol/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # =================================================================== 4 | # The contents of this file are dedicated to the public domain. To 5 | # the extent that dedication to the public domain is not available, 6 | # everyone is granted a worldwide, perpetual, royalty-free, 7 | # non-exclusive license to exercise all rights associated with the 8 | # contents of this file for any purpose whatsoever. 9 | # No rights are reserved. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 12 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 15 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 16 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | # SOFTWARE. 19 | # =================================================================== 20 | 21 | """Cryptographic protocols 22 | 23 | Implements various cryptographic protocols. (Don't expect to find 24 | network protocols here.) 25 | 26 | Crypto.Protocol.AllOrNothing 27 | Transforms a message into a set of message blocks, such that the blocks 28 | can be recombined to get the message back. 29 | 30 | Crypto.Protocol.Chaffing 31 | Takes a set of authenticated message blocks (the wheat) and adds a number 32 | of randomly generated blocks (the chaff). 33 | 34 | Crypto.Protocol.KDF 35 | A collection of standard key derivation functions. 36 | 37 | :undocumented: __revision__ 38 | """ 39 | 40 | __all__ = ['AllOrNothing', 'Chaffing', 'KDF'] 41 | __revision__ = "$Id$" 42 | -------------------------------------------------------------------------------- /executor/libs/Crypto/PublicKey/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # =================================================================== 4 | # The contents of this file are dedicated to the public domain. To 5 | # the extent that dedication to the public domain is not available, 6 | # everyone is granted a worldwide, perpetual, royalty-free, 7 | # non-exclusive license to exercise all rights associated with the 8 | # contents of this file for any purpose whatsoever. 9 | # No rights are reserved. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 12 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 15 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 16 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | # SOFTWARE. 19 | # =================================================================== 20 | 21 | """Public-key encryption and signature algorithms. 22 | 23 | Public-key encryption uses two different keys, one for encryption and 24 | one for decryption. The encryption key can be made public, and the 25 | decryption key is kept private. Many public-key algorithms can also 26 | be used to sign messages, and some can *only* be used for signatures. 27 | 28 | ======================== ============================================= 29 | Module Description 30 | ======================== ============================================= 31 | Crypto.PublicKey.DSA Digital Signature Algorithm (Signature only) 32 | Crypto.PublicKey.ElGamal (Signing and encryption) 33 | Crypto.PublicKey.RSA (Signing, encryption, and blinding) 34 | ======================== ============================================= 35 | 36 | :undocumented: _DSA, _RSA, _fastmath, _slowmath, pubkey 37 | """ 38 | 39 | __all__ = ['RSA', 'DSA', 'ElGamal'] 40 | __revision__ = "$Id$" 41 | 42 | -------------------------------------------------------------------------------- /executor/libs/Crypto/PublicKey/_fastmath.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/PublicKey/_fastmath.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Random/Fortuna/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Random/Fortuna/__init__.py -------------------------------------------------------------------------------- /executor/libs/Crypto/Random/OSRNG/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Random/OSRNG/__init__.py : Platform-independent OS RNG API 3 | # 4 | # Written in 2008 by Dwayne C. Litzenberger 5 | # 6 | # =================================================================== 7 | # The contents of this file are dedicated to the public domain. To 8 | # the extent that dedication to the public domain is not available, 9 | # everyone is granted a worldwide, perpetual, royalty-free, 10 | # non-exclusive license to exercise all rights associated with the 11 | # contents of this file for any purpose whatsoever. 12 | # No rights are reserved. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | # =================================================================== 23 | 24 | """Provides a platform-independent interface to the random number generators 25 | supplied by various operating systems.""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import os 30 | 31 | if os.name == 'posix': 32 | from Crypto.Random.OSRNG.posix import new 33 | elif os.name == 'nt': 34 | from Crypto.Random.OSRNG.nt import new 35 | elif hasattr(os, 'urandom'): 36 | from Crypto.Random.OSRNG.fallback import new 37 | else: 38 | raise ImportError("Not implemented") 39 | 40 | # vim:set ts=4 sw=4 sts=4 expandtab: 41 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Random/OSRNG/fallback.py: -------------------------------------------------------------------------------- 1 | # 2 | # Random/OSRNG/fallback.py : Fallback entropy source for systems with os.urandom 3 | # 4 | # Written in 2008 by Dwayne C. Litzenberger 5 | # 6 | # =================================================================== 7 | # The contents of this file are dedicated to the public domain. To 8 | # the extent that dedication to the public domain is not available, 9 | # everyone is granted a worldwide, perpetual, royalty-free, 10 | # non-exclusive license to exercise all rights associated with the 11 | # contents of this file for any purpose whatsoever. 12 | # No rights are reserved. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | # =================================================================== 23 | 24 | 25 | __revision__ = "$Id$" 26 | __all__ = ['PythonOSURandomRNG'] 27 | 28 | import os 29 | 30 | from rng_base import BaseRNG 31 | 32 | class PythonOSURandomRNG(BaseRNG): 33 | 34 | name = "" 35 | 36 | def __init__(self): 37 | self._read = os.urandom 38 | BaseRNG.__init__(self) 39 | 40 | def _close(self): 41 | self._read = None 42 | 43 | def new(*args, **kwargs): 44 | return PythonOSURandomRNG(*args, **kwargs) 45 | 46 | # vim:set ts=4 sw=4 sts=4 expandtab: 47 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Random/OSRNG/nt.py: -------------------------------------------------------------------------------- 1 | # 2 | # Random/OSRNG/nt.py : OS entropy source for MS Windows 3 | # 4 | # Written in 2008 by Dwayne C. Litzenberger 5 | # 6 | # =================================================================== 7 | # The contents of this file are dedicated to the public domain. To 8 | # the extent that dedication to the public domain is not available, 9 | # everyone is granted a worldwide, perpetual, royalty-free, 10 | # non-exclusive license to exercise all rights associated with the 11 | # contents of this file for any purpose whatsoever. 12 | # No rights are reserved. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | # =================================================================== 23 | 24 | 25 | __revision__ = "$Id$" 26 | __all__ = ['WindowsRNG'] 27 | 28 | import winrandom 29 | from rng_base import BaseRNG 30 | 31 | class WindowsRNG(BaseRNG): 32 | 33 | name = "" 34 | 35 | def __init__(self): 36 | self.__winrand = winrandom.new() 37 | BaseRNG.__init__(self) 38 | 39 | def flush(self): 40 | """Work around weakness in Windows RNG. 41 | 42 | The CryptGenRandom mechanism in some versions of Windows allows an 43 | attacker to learn 128 KiB of past and future output. As a workaround, 44 | this function reads 128 KiB of 'random' data from Windows and discards 45 | it. 46 | 47 | For more information about the weaknesses in CryptGenRandom, see 48 | _Cryptanalysis of the Random Number Generator of the Windows Operating 49 | System_, by Leo Dorrendorf and Zvi Gutterman and Benny Pinkas 50 | http://eprint.iacr.org/2007/419 51 | """ 52 | if self.closed: 53 | raise ValueError("I/O operation on closed file") 54 | data = self.__winrand.get_bytes(128*1024) 55 | assert (len(data) == 128*1024) 56 | BaseRNG.flush(self) 57 | 58 | def _close(self): 59 | self.__winrand = None 60 | 61 | def _read(self, N): 62 | # Unfortunately, research shows that CryptGenRandom doesn't provide 63 | # forward secrecy and fails the next-bit test unless we apply a 64 | # workaround, which we do here. See http://eprint.iacr.org/2007/419 65 | # for information on the vulnerability. 66 | self.flush() 67 | data = self.__winrand.get_bytes(N) 68 | self.flush() 69 | return data 70 | 71 | def new(*args, **kwargs): 72 | return WindowsRNG(*args, **kwargs) 73 | 74 | # vim:set ts=4 sw=4 sts=4 expandtab: 75 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Random/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Random/__init__.py : PyCrypto random number generation 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | __revision__ = "$Id$" 26 | __all__ = ['new'] 27 | 28 | from Crypto.Random import OSRNG 29 | from Crypto.Random import _UserFriendlyRNG 30 | 31 | def new(*args, **kwargs): 32 | """Return a file-like object that outputs cryptographically random bytes.""" 33 | return _UserFriendlyRNG.new(*args, **kwargs) 34 | 35 | def atfork(): 36 | """Call this whenever you call os.fork()""" 37 | _UserFriendlyRNG.reinit() 38 | 39 | def get_random_bytes(n): 40 | """Return the specified number of cryptographically-strong random bytes.""" 41 | return _UserFriendlyRNG.get_random_bytes(n) 42 | 43 | # vim:set ts=4 sw=4 sts=4 expandtab: 44 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Cipher/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Cipher/__init__.py: Self-test for cipher modules 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for cipher modules""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | def get_tests(config={}): 30 | tests = [] 31 | from Crypto.SelfTest.Cipher import test_AES; tests += test_AES.get_tests(config=config) 32 | from Crypto.SelfTest.Cipher import test_ARC2; tests += test_ARC2.get_tests(config=config) 33 | from Crypto.SelfTest.Cipher import test_ARC4; tests += test_ARC4.get_tests(config=config) 34 | from Crypto.SelfTest.Cipher import test_Blowfish; tests += test_Blowfish.get_tests(config=config) 35 | from Crypto.SelfTest.Cipher import test_CAST; tests += test_CAST.get_tests(config=config) 36 | from Crypto.SelfTest.Cipher import test_DES3; tests += test_DES3.get_tests(config=config) 37 | from Crypto.SelfTest.Cipher import test_DES; tests += test_DES.get_tests(config=config) 38 | from Crypto.SelfTest.Cipher import test_XOR; tests += test_XOR.get_tests(config=config) 39 | from Crypto.SelfTest.Cipher import test_pkcs1_15; tests += test_pkcs1_15.get_tests(config=config) 40 | from Crypto.SelfTest.Cipher import test_pkcs1_oaep; tests += test_pkcs1_oaep.get_tests(config=config) 41 | return tests 42 | 43 | if __name__ == '__main__': 44 | import unittest 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | # vim:set ts=4 sw=4 sts=4 expandtab: 49 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Cipher/test_CAST.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Cipher/CAST.py: Self-test for the CAST-128 (CAST5) cipher 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Cipher.CAST""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | from Crypto.Util.py3compat import * 30 | 31 | # This is a list of (plaintext, ciphertext, key) tuples. 32 | test_data = [ 33 | # Test vectors from RFC 2144, B.1 34 | ('0123456789abcdef', '238b4fe5847e44b2', 35 | '0123456712345678234567893456789a', 36 | '128-bit key'), 37 | 38 | ('0123456789abcdef', 'eb6a711a2c02271b', 39 | '01234567123456782345', 40 | '80-bit key'), 41 | 42 | ('0123456789abcdef', '7ac816d16e9b302e', 43 | '0123456712', 44 | '40-bit key'), 45 | ] 46 | 47 | def get_tests(config={}): 48 | from Crypto.Cipher import CAST 49 | from common import make_block_tests 50 | return make_block_tests(CAST, "CAST", test_data) 51 | 52 | if __name__ == '__main__': 53 | import unittest 54 | suite = lambda: unittest.TestSuite(get_tests()) 55 | unittest.main(defaultTest='suite') 56 | 57 | # vim:set ts=4 sw=4 sts=4 expandtab: 58 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Cipher/test_XOR.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Cipher/XOR.py: Self-test for the XOR "cipher" 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Cipher.XOR""" 26 | 27 | import unittest 28 | 29 | __revision__ = "$Id$" 30 | 31 | from Crypto.Util.py3compat import * 32 | 33 | # This is a list of (plaintext, ciphertext, key) tuples. 34 | test_data = [ 35 | # Test vectors written from scratch. (Nobody posts XOR test vectors on the web? How disappointing.) 36 | ('01', '01', 37 | '00', 38 | 'zero key'), 39 | 40 | ('0102040810204080', '0003050911214181', 41 | '01', 42 | '1-byte key'), 43 | 44 | ('0102040810204080', 'cda8c8a2dc8a8c2a', 45 | 'ccaa', 46 | '2-byte key'), 47 | 48 | ('ff'*64, 'fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0'*2, 49 | '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 50 | '32-byte key'), 51 | ] 52 | 53 | class TruncationSelfTest(unittest.TestCase): 54 | 55 | def runTest(self): 56 | """33-byte key (should raise ValueError under current implementation)""" 57 | # Crypto.Cipher.XOR previously truncated its inputs at 32 bytes. Now 58 | # it should raise a ValueError if the length is too long. 59 | self.assertRaises(ValueError, XOR.new, "x"*33) 60 | 61 | def get_tests(config={}): 62 | global XOR 63 | from Crypto.Cipher import XOR 64 | from common import make_stream_tests 65 | return make_stream_tests(XOR, "XOR", test_data) + [TruncationSelfTest()] 66 | 67 | if __name__ == '__main__': 68 | import unittest 69 | suite = lambda: unittest.TestSuite(get_tests()) 70 | unittest.main(defaultTest='suite') 71 | 72 | # vim:set ts=4 sw=4 sts=4 expandtab: 73 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Hash/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Hash/__init__.py: Self-test for hash modules 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for hash modules""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | def get_tests(config={}): 30 | tests = [] 31 | from Crypto.SelfTest.Hash import test_HMAC; tests += test_HMAC.get_tests(config=config) 32 | from Crypto.SelfTest.Hash import test_MD2; tests += test_MD2.get_tests(config=config) 33 | from Crypto.SelfTest.Hash import test_MD4; tests += test_MD4.get_tests(config=config) 34 | from Crypto.SelfTest.Hash import test_MD5; tests += test_MD5.get_tests(config=config) 35 | from Crypto.SelfTest.Hash import test_RIPEMD; tests += test_RIPEMD.get_tests(config=config) 36 | from Crypto.SelfTest.Hash import test_SHA; tests += test_SHA.get_tests(config=config) 37 | from Crypto.SelfTest.Hash import test_SHA256; tests += test_SHA256.get_tests(config=config) 38 | try: 39 | from Crypto.SelfTest.Hash import test_SHA224; tests += test_SHA224.get_tests(config=config) 40 | from Crypto.SelfTest.Hash import test_SHA384; tests += test_SHA384.get_tests(config=config) 41 | from Crypto.SelfTest.Hash import test_SHA512; tests += test_SHA512.get_tests(config=config) 42 | except ImportError: 43 | import sys 44 | sys.stderr.write("SelfTest: warning: not testing SHA224/SHA384/SHA512 modules (not available)\n") 45 | return tests 46 | 47 | if __name__ == '__main__': 48 | import unittest 49 | suite = lambda: unittest.TestSuite(get_tests()) 50 | unittest.main(defaultTest='suite') 51 | 52 | # vim:set ts=4 sw=4 sts=4 expandtab: 53 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Hash/test_MD2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Hash/MD2.py: Self-test for the MD2 hash function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Hash.MD2""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | from Crypto.Util.py3compat import * 30 | 31 | # This is a list of (expected_result, input[, description]) tuples. 32 | test_data = [ 33 | # Test vectors from RFC 1319 34 | ('8350e5a3e24c153df2275c9f80692773', '', "'' (empty string)"), 35 | ('32ec01ec4a6dac72c0ab96fb34c0b5d1', 'a'), 36 | ('da853b0d3f88d99b30283a69e6ded6bb', 'abc'), 37 | ('ab4f496bfb2a530b219ff33031fe06b0', 'message digest'), 38 | 39 | ('4e8ddff3650292ab5a4108c3aa47940b', 'abcdefghijklmnopqrstuvwxyz', 40 | 'a-z'), 41 | 42 | ('da33def2a42df13975352846c30338cd', 43 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 44 | 'A-Z, a-z, 0-9'), 45 | 46 | ('d5976f79d83d3a0dc9806c3c66f3efd8', 47 | '1234567890123456789012345678901234567890123456' 48 | + '7890123456789012345678901234567890', 49 | "'1234567890' * 8"), 50 | ] 51 | 52 | def get_tests(config={}): 53 | from Crypto.Hash import MD2 54 | from common import make_hash_tests 55 | return make_hash_tests(MD2, "MD2", test_data, 56 | digest_size=16, 57 | oid="\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x02") 58 | 59 | if __name__ == '__main__': 60 | import unittest 61 | suite = lambda: unittest.TestSuite(get_tests()) 62 | unittest.main(defaultTest='suite') 63 | 64 | # vim:set ts=4 sw=4 sts=4 expandtab: 65 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Hash/test_MD4.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Hash/MD4.py: Self-test for the MD4 hash function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Hash.MD4""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | from Crypto.Util.py3compat import * 30 | 31 | # This is a list of (expected_result, input[, description]) tuples. 32 | test_data = [ 33 | # Test vectors from RFC 1320 34 | ('31d6cfe0d16ae931b73c59d7e0c089c0', '', "'' (empty string)"), 35 | ('bde52cb31de33e46245e05fbdbd6fb24', 'a'), 36 | ('a448017aaf21d8525fc10ae87aa6729d', 'abc'), 37 | ('d9130a8164549fe818874806e1c7014b', 'message digest'), 38 | 39 | ('d79e1c308aa5bbcdeea8ed63df412da9', 'abcdefghijklmnopqrstuvwxyz', 40 | 'a-z'), 41 | 42 | ('043f8582f241db351ce627e153e7f0e4', 43 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 44 | 'A-Z, a-z, 0-9'), 45 | 46 | ('e33b4ddc9c38f2199c3e7b164fcc0536', 47 | '1234567890123456789012345678901234567890123456' 48 | + '7890123456789012345678901234567890', 49 | "'1234567890' * 8"), 50 | ] 51 | 52 | def get_tests(config={}): 53 | from Crypto.Hash import MD4 54 | from common import make_hash_tests 55 | return make_hash_tests(MD4, "MD4", test_data, 56 | digest_size=16, 57 | oid="\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x04") 58 | 59 | if __name__ == '__main__': 60 | import unittest 61 | suite = lambda: unittest.TestSuite(get_tests()) 62 | unittest.main(defaultTest='suite') 63 | 64 | # vim:set ts=4 sw=4 sts=4 expandtab: 65 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Hash/test_MD5.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Hash/MD5.py: Self-test for the MD5 hash function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Hash.MD5""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | from Crypto.Util.py3compat import * 30 | 31 | # This is a list of (expected_result, input[, description]) tuples. 32 | test_data = [ 33 | # Test vectors from RFC 1321 34 | ('d41d8cd98f00b204e9800998ecf8427e', '', "'' (empty string)"), 35 | ('0cc175b9c0f1b6a831c399e269772661', 'a'), 36 | ('900150983cd24fb0d6963f7d28e17f72', 'abc'), 37 | ('f96b697d7cb7938d525a2f31aaf161d0', 'message digest'), 38 | 39 | ('c3fcd3d76192e4007dfb496cca67e13b', 'abcdefghijklmnopqrstuvwxyz', 40 | 'a-z'), 41 | 42 | ('d174ab98d277d9f5a5611c2c9f419d9f', 43 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 44 | 'A-Z, a-z, 0-9'), 45 | 46 | ('57edf4a22be3c955ac49da2e2107b67a', 47 | '1234567890123456789012345678901234567890123456' 48 | + '7890123456789012345678901234567890', 49 | "'1234567890' * 8"), 50 | ] 51 | 52 | def get_tests(config={}): 53 | from Crypto.Hash import MD5 54 | from common import make_hash_tests 55 | return make_hash_tests(MD5, "MD5", test_data, 56 | digest_size=16, 57 | oid="\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05") 58 | 59 | if __name__ == '__main__': 60 | import unittest 61 | suite = lambda: unittest.TestSuite(get_tests()) 62 | unittest.main(defaultTest='suite') 63 | 64 | # vim:set ts=4 sw=4 sts=4 expandtab: 65 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Hash/test_RIPEMD.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Hash/test_RIPEMD.py: Self-test for the RIPEMD-160 hash function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | #"""Self-test suite for Crypto.Hash.RIPEMD""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | from Crypto.Util.py3compat import * 30 | 31 | # This is a list of (expected_result, input[, description]) tuples. 32 | test_data = [ 33 | # Test vectors downloaded 2008-09-12 from 34 | # http://homes.esat.kuleuven.be/~bosselae/ripemd160.html 35 | ('9c1185a5c5e9fc54612808977ee8f548b2258d31', '', "'' (empty string)"), 36 | ('0bdc9d2d256b3ee9daae347be6f4dc835a467ffe', 'a'), 37 | ('8eb208f7e05d987a9b044a8e98c6b087f15a0bfc', 'abc'), 38 | ('5d0689ef49d2fae572b881b123a85ffa21595f36', 'message digest'), 39 | 40 | ('f71c27109c692c1b56bbdceb5b9d2865b3708dbc', 41 | 'abcdefghijklmnopqrstuvwxyz', 42 | 'a-z'), 43 | 44 | ('12a053384a9c0c88e405a06c27dcf49ada62eb2b', 45 | 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 46 | 'abcdbcd...pnopq'), 47 | 48 | ('b0e20b6e3116640286ed3a87a5713079b21f5189', 49 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 50 | 'A-Z, a-z, 0-9'), 51 | 52 | ('9b752e45573d4b39f4dbd3323cab82bf63326bfb', 53 | '1234567890' * 8, 54 | "'1234567890' * 8"), 55 | 56 | ('52783243c1697bdbe16d37f97f68f08325dc1528', 57 | 'a' * 10**6, 58 | '"a" * 10**6'), 59 | ] 60 | 61 | def get_tests(config={}): 62 | from Crypto.Hash import RIPEMD 63 | from common import make_hash_tests 64 | return make_hash_tests(RIPEMD, "RIPEMD", test_data, 65 | digest_size=20, 66 | oid="\x06\x05\x2b\x24\x03\02\x01") 67 | 68 | if __name__ == '__main__': 69 | import unittest 70 | suite = lambda: unittest.TestSuite(get_tests()) 71 | unittest.main(defaultTest='suite') 72 | 73 | # vim:set ts=4 sw=4 sts=4 expandtab: 74 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Hash/test_SHA.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Hash/SHA.py: Self-test for the SHA-1 hash function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Hash.SHA""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | from Crypto.Util.py3compat import * 30 | 31 | # Test vectors from various sources 32 | # This is a list of (expected_result, input[, description]) tuples. 33 | test_data = [ 34 | # FIPS PUB 180-2, A.1 - "One-Block Message" 35 | ('a9993e364706816aba3e25717850c26c9cd0d89d', 'abc'), 36 | 37 | # FIPS PUB 180-2, A.2 - "Multi-Block Message" 38 | ('84983e441c3bd26ebaae4aa1f95129e5e54670f1', 39 | 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'), 40 | 41 | # FIPS PUB 180-2, A.3 - "Long Message" 42 | # ('34aa973cd4c4daa4f61eeb2bdbad27316534016f', 43 | # 'a' * 10**6, 44 | # '"a" * 10**6'), 45 | 46 | # RFC 3174: Section 7.3, "TEST4" (multiple of 512 bits) 47 | ('dea356a2cddd90c7a7ecedc5ebb563934f460452', 48 | '01234567' * 80, 49 | '"01234567" * 80'), 50 | ] 51 | 52 | def get_tests(config={}): 53 | from Crypto.Hash import SHA 54 | from common import make_hash_tests 55 | return make_hash_tests(SHA, "SHA", test_data, 56 | digest_size=20, 57 | oid="\x06\x05\x2B\x0E\x03\x02\x1A") 58 | 59 | if __name__ == '__main__': 60 | import unittest 61 | suite = lambda: unittest.TestSuite(get_tests()) 62 | unittest.main(defaultTest='suite') 63 | 64 | # vim:set ts=4 sw=4 sts=4 expandtab: 65 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Hash/test_SHA224.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Hash/test_SHA224.py: Self-test for the SHA-224 hash function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Hash.SHA224""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | # Test vectors from various sources 30 | # This is a list of (expected_result, input[, description]) tuples. 31 | test_data = [ 32 | 33 | # RFC 3874: Section 3.1, "Test Vector #1 34 | ('23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7', 'abc'), 35 | 36 | # RFC 3874: Section 3.2, "Test Vector #2 37 | ('75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'), 38 | 39 | # RFC 3874: Section 3.3, "Test Vector #3 40 | ('20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67', 'a' * 10**6, "'a' * 10**6"), 41 | 42 | # Examples from http://de.wikipedia.org/wiki/Secure_Hash_Algorithm 43 | ('d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f', ''), 44 | 45 | ('49b08defa65e644cbf8a2dd9270bdededabc741997d1dadd42026d7b', 46 | 'Franz jagt im komplett verwahrlosten Taxi quer durch Bayern'), 47 | 48 | ('58911e7fccf2971a7d07f93162d8bd13568e71aa8fc86fc1fe9043d1', 49 | 'Frank jagt im komplett verwahrlosten Taxi quer durch Bayern'), 50 | 51 | ] 52 | 53 | def get_tests(config={}): 54 | from Crypto.Hash import SHA224 55 | from common import make_hash_tests 56 | return make_hash_tests(SHA224, "SHA224", test_data, 57 | digest_size=28, 58 | oid='\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04') 59 | 60 | if __name__ == '__main__': 61 | import unittest 62 | suite = lambda: unittest.TestSuite(get_tests()) 63 | unittest.main(defaultTest='suite') 64 | 65 | # vim:set ts=4 sw=4 sts=4 expandtab: 66 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Protocol/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Protocol/__init__.py: Self-tests for Crypto.Protocol 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for Crypto.Protocol""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | def get_tests(config={}): 30 | tests = [] 31 | from Crypto.SelfTest.Protocol import test_chaffing; tests += test_chaffing.get_tests(config=config) 32 | from Crypto.SelfTest.Protocol import test_rfc1751; tests += test_rfc1751.get_tests(config=config) 33 | from Crypto.SelfTest.Protocol import test_AllOrNothing; tests += test_AllOrNothing.get_tests(config=config) 34 | return tests 35 | 36 | if __name__ == '__main__': 37 | import unittest 38 | suite = lambda: unittest.TestSuite(get_tests()) 39 | unittest.main(defaultTest='suite') 40 | 41 | # vim:set ts=4 sw=4 sts=4 expandtab: 42 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Protocol/test_rfc1751.py: -------------------------------------------------------------------------------- 1 | # 2 | # Test script for Crypto.Util.RFC1751. 3 | # 4 | # Part of the Python Cryptography Toolkit 5 | # 6 | # Written by Andrew Kuchling and others 7 | # 8 | # =================================================================== 9 | # The contents of this file are dedicated to the public domain. To 10 | # the extent that dedication to the public domain is not available, 11 | # everyone is granted a worldwide, perpetual, royalty-free, 12 | # non-exclusive license to exercise all rights associated with the 13 | # contents of this file for any purpose whatsoever. 14 | # No rights are reserved. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # SOFTWARE. 24 | # =================================================================== 25 | 26 | __revision__ = "$Id$" 27 | 28 | import binascii 29 | import unittest 30 | from Crypto.Util import RFC1751 31 | from Crypto.Util.py3compat import * 32 | 33 | test_data = [('EB33F77EE73D4053', 'TIDE ITCH SLOW REIN RULE MOT'), 34 | ('CCAC2AED591056BE4F90FD441C534766', 35 | 'RASH BUSH MILK LOOK BAD BRIM AVID GAFF BAIT ROT POD LOVE'), 36 | ('EFF81F9BFBC65350920CDD7416DE8009', 37 | 'TROD MUTE TAIL WARM CHAR KONG HAAG CITY BORE O TEAL AWL') 38 | ] 39 | 40 | class RFC1751Test_k2e (unittest.TestCase): 41 | 42 | def runTest (self): 43 | "Check converting keys to English" 44 | for key, words in test_data: 45 | key=binascii.a2b_hex(b(key)) 46 | self.assertEqual(RFC1751.key_to_english(key), words) 47 | 48 | class RFC1751Test_e2k (unittest.TestCase): 49 | 50 | def runTest (self): 51 | "Check converting English strings to keys" 52 | for key, words in test_data: 53 | key=binascii.a2b_hex(b(key)) 54 | self.assertEqual(RFC1751.english_to_key(words), key) 55 | 56 | # class RFC1751Test 57 | 58 | def get_tests(config={}): 59 | return [RFC1751Test_k2e(), RFC1751Test_e2k()] 60 | 61 | if __name__ == "__main__": 62 | unittest.main() 63 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/PublicKey/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/PublicKey/__init__.py: Self-test for public key crypto 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for public-key crypto""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import os 30 | 31 | def get_tests(config={}): 32 | tests = [] 33 | from Crypto.SelfTest.PublicKey import test_DSA; tests += test_DSA.get_tests(config=config) 34 | from Crypto.SelfTest.PublicKey import test_RSA; tests += test_RSA.get_tests(config=config) 35 | from Crypto.SelfTest.PublicKey import test_importKey; tests += test_importKey.get_tests(config=config) 36 | from Crypto.SelfTest.PublicKey import test_ElGamal; tests += test_ElGamal.get_tests(config=config) 37 | return tests 38 | 39 | if __name__ == '__main__': 40 | import unittest 41 | suite = lambda: unittest.TestSuite(get_tests()) 42 | unittest.main(defaultTest='suite') 43 | 44 | # vim:set ts=4 sw=4 sts=4 expandtab: 45 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/Fortuna/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Random/Fortuna/__init__.py: Self-test for Fortuna modules 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for the Crypto.Random.Fortuna package""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import os 30 | 31 | def get_tests(config={}): 32 | tests = [] 33 | from Crypto.SelfTest.Random.Fortuna import test_FortunaAccumulator; tests += test_FortunaAccumulator.get_tests(config=config) 34 | from Crypto.SelfTest.Random.Fortuna import test_FortunaGenerator; tests += test_FortunaGenerator.get_tests(config=config) 35 | from Crypto.SelfTest.Random.Fortuna import test_SHAd256; tests += test_SHAd256.get_tests(config=config) 36 | return tests 37 | 38 | if __name__ == '__main__': 39 | import unittest 40 | suite = lambda: unittest.TestSuite(get_tests()) 41 | unittest.main(defaultTest='suite') 42 | 43 | 44 | # vim:set ts=4 sw=4 sts=4 expandtab: 45 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/Fortuna/test_SHAd256.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Random/Fortuna/test_SHAd256.py: Self-test for the SHAd256 hash function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Random.Fortuna.SHAd256""" 26 | 27 | __revision__ = "$Id$" 28 | from Crypto.Util.py3compat import * 29 | 30 | # This is a list of (expected_result, input[, description]) tuples. 31 | test_data = [ 32 | # I could not find any test vectors for SHAd256, so I made these vectors by 33 | # feeding some sample data into several plain SHA256 implementations 34 | # (including OpenSSL, the "sha256sum" tool, and this implementation). 35 | # This is a subset of the resulting test vectors. The complete list can be 36 | # found at: http://www.dlitz.net/crypto/shad256-test-vectors/ 37 | ('5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456', 38 | '', "'' (empty string)"), 39 | ('4f8b42c22dd3729b519ba6f68d2da7cc5b2d606d05daed5ad5128cc03e6c6358', 40 | 'abc'), 41 | ('0cffe17f68954dac3a84fb1458bd5ec99209449749b2b308b7cb55812f9563af', 42 | 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') 43 | ] 44 | 45 | def get_tests(config={}): 46 | from Crypto.Random.Fortuna import SHAd256 47 | from Crypto.SelfTest.Hash.common import make_hash_tests 48 | return make_hash_tests(SHAd256, "SHAd256", test_data, 32) 49 | 50 | if __name__ == '__main__': 51 | import unittest 52 | suite = lambda: unittest.TestSuite(get_tests()) 53 | unittest.main(defaultTest='suite') 54 | 55 | # vim:set ts=4 sw=4 sts=4 expandtab: 56 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/OSRNG/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Random/OSRNG/__init__.py: Self-test for OSRNG modules 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for Crypto.Random.OSRNG package""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import os 30 | 31 | def get_tests(config={}): 32 | tests = [] 33 | if os.name == 'nt': 34 | from Crypto.SelfTest.Random.OSRNG import test_nt; tests += test_nt.get_tests(config=config) 35 | from Crypto.SelfTest.Random.OSRNG import test_winrandom; tests += test_winrandom.get_tests(config=config) 36 | elif os.name == 'posix': 37 | from Crypto.SelfTest.Random.OSRNG import test_posix; tests += test_posix.get_tests(config=config) 38 | if hasattr(os, 'urandom'): 39 | from Crypto.SelfTest.Random.OSRNG import test_fallback; tests += test_fallback.get_tests(config=config) 40 | from Crypto.SelfTest.Random.OSRNG import test_generic; tests += test_generic.get_tests(config=config) 41 | return tests 42 | 43 | if __name__ == '__main__': 44 | import unittest 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | 49 | # vim:set ts=4 sw=4 sts=4 expandtab: 50 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/OSRNG/test_fallback.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/test_fallback.py: Self-test for the OSRNG.fallback.new() function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Random.OSRNG.fallback""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import unittest 30 | 31 | class SimpleTest(unittest.TestCase): 32 | def runTest(self): 33 | """Crypto.Random.OSRNG.fallback.new()""" 34 | # Import the OSRNG.nt module and try to use it 35 | import Crypto.Random.OSRNG.fallback 36 | randobj = Crypto.Random.OSRNG.fallback.new() 37 | x = randobj.read(16) 38 | y = randobj.read(16) 39 | self.assertNotEqual(x, y) 40 | 41 | def get_tests(config={}): 42 | return [SimpleTest()] 43 | 44 | if __name__ == '__main__': 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | # vim:set ts=4 sw=4 sts=4 expandtab: 49 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/OSRNG/test_generic.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/test_generic.py: Self-test for the OSRNG.new() function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Random.OSRNG""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import unittest 30 | 31 | class SimpleTest(unittest.TestCase): 32 | def runTest(self): 33 | """Crypto.Random.OSRNG.new()""" 34 | # Import the OSRNG module and try to use it 35 | import Crypto.Random.OSRNG 36 | randobj = Crypto.Random.OSRNG.new() 37 | x = randobj.read(16) 38 | y = randobj.read(16) 39 | self.assertNotEqual(x, y) 40 | 41 | def get_tests(config={}): 42 | return [SimpleTest()] 43 | 44 | if __name__ == '__main__': 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | # vim:set ts=4 sw=4 sts=4 expandtab: 49 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/OSRNG/test_nt.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/test_generic.py: Self-test for the OSRNG.nt.new() function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Random.OSRNG.nt""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import unittest 30 | 31 | class SimpleTest(unittest.TestCase): 32 | def runTest(self): 33 | """Crypto.Random.OSRNG.nt.new()""" 34 | # Import the OSRNG.nt module and try to use it 35 | import Crypto.Random.OSRNG.nt 36 | randobj = Crypto.Random.OSRNG.nt.new() 37 | x = randobj.read(16) 38 | y = randobj.read(16) 39 | self.assertNotEqual(x, y) 40 | 41 | def get_tests(config={}): 42 | return [SimpleTest()] 43 | 44 | if __name__ == '__main__': 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | # vim:set ts=4 sw=4 sts=4 expandtab: 49 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/OSRNG/test_posix.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/test_posix.py: Self-test for the OSRNG.posix.new() function 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Random.OSRNG.posix""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import unittest 30 | 31 | class SimpleTest(unittest.TestCase): 32 | def runTest(self): 33 | """Crypto.Random.OSRNG.posix.new()""" 34 | # Import the OSRNG.nt module and try to use it 35 | import Crypto.Random.OSRNG.posix 36 | randobj = Crypto.Random.OSRNG.posix.new() 37 | x = randobj.read(16) 38 | y = randobj.read(16) 39 | self.assertNotEqual(x, y) 40 | 41 | def get_tests(config={}): 42 | return [SimpleTest()] 43 | 44 | if __name__ == '__main__': 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | # vim:set ts=4 sw=4 sts=4 expandtab: 49 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/OSRNG/test_winrandom.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/test_winrandom.py: Self-test for the winrandom module 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Random.OSRNG.winrandom""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import unittest 30 | 31 | class SimpleTest(unittest.TestCase): 32 | def runTest(self): 33 | """Crypto.Random.OSRNG.winrandom""" 34 | # Import the winrandom module and try to use it 35 | from Crypto.Random.OSRNG import winrandom 36 | randobj = winrandom.new() 37 | x = randobj.get_bytes(16) 38 | y = randobj.get_bytes(16) 39 | self.assertNotEqual(x, y) 40 | 41 | def get_tests(config={}): 42 | return [SimpleTest()] 43 | 44 | if __name__ == '__main__': 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | # vim:set ts=4 sw=4 sts=4 expandtab: 49 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Random/__init__.py: Self-test for random number generation modules 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for random number generators""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | def get_tests(config={}): 30 | tests = [] 31 | from Crypto.SelfTest.Random import Fortuna; tests += Fortuna.get_tests(config=config) 32 | from Crypto.SelfTest.Random import OSRNG; tests += OSRNG.get_tests(config=config) 33 | from Crypto.SelfTest.Random import test_random; tests += test_random.get_tests(config=config) 34 | from Crypto.SelfTest.Random import test_rpoolcompat; tests += test_rpoolcompat.get_tests(config=config) 35 | from Crypto.SelfTest.Random import test__UserFriendlyRNG; tests += test__UserFriendlyRNG.get_tests(config=config) 36 | return tests 37 | 38 | if __name__ == '__main__': 39 | import unittest 40 | suite = lambda: unittest.TestSuite(get_tests()) 41 | unittest.main(defaultTest='suite') 42 | 43 | # vim:set ts=4 sw=4 sts=4 expandtab: 44 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Random/test_rpoolcompat.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/test_winrandom.py: Self-test for the winrandom module 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for the Crypto.Util.randpool.RandomPool wrapper class""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import sys 30 | import unittest 31 | 32 | class SimpleTest(unittest.TestCase): 33 | def runTest(self): 34 | """Crypto.Util.randpool.RandomPool""" 35 | # Import the winrandom module and try to use it 36 | from Crypto.Util.randpool import RandomPool 37 | sys.stderr.write("SelfTest: You can ignore the RandomPool_DeprecationWarning that follows.\n") 38 | rpool = RandomPool() 39 | x = rpool.get_bytes(16) 40 | y = rpool.get_bytes(16) 41 | self.assertNotEqual(x, y) 42 | self.assertNotEqual(rpool.entropy, 0) 43 | 44 | rpool.randomize() 45 | rpool.stir('foo') 46 | rpool.add_event('foo') 47 | 48 | def get_tests(config={}): 49 | return [SimpleTest()] 50 | 51 | if __name__ == '__main__': 52 | suite = lambda: unittest.TestSuite(get_tests()) 53 | unittest.main(defaultTest='suite') 54 | 55 | # vim:set ts=4 sw=4 sts=4 expandtab: 56 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Signature/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Signature/__init__.py: Self-test for signature modules 4 | # 5 | # =================================================================== 6 | # The contents of this file are dedicated to the public domain. To 7 | # the extent that dedication to the public domain is not available, 8 | # everyone is granted a worldwide, perpetual, royalty-free, 9 | # non-exclusive license to exercise all rights associated with the 10 | # contents of this file for any purpose whatsoever. 11 | # No rights are reserved. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 16 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 17 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 18 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | # SOFTWARE. 21 | # =================================================================== 22 | 23 | """Self-test for signature modules""" 24 | 25 | __revision__ = "$Id$" 26 | 27 | import os 28 | 29 | def get_tests(config={}): 30 | tests = [] 31 | import test_pkcs1_15; tests += test_pkcs1_15.get_tests(config=config) 32 | import test_pkcs1_pss; tests += test_pkcs1_pss.get_tests(config=config) 33 | return tests 34 | 35 | if __name__ == '__main__': 36 | import unittest 37 | suite = lambda: unittest.TestSuite(get_tests()) 38 | unittest.main(defaultTest='suite') 39 | 40 | # vim:set ts=4 sw=4 sts=4 expandtab: 41 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Util/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/__init__.py: Self-test for utility modules 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test for utility modules""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import os 30 | 31 | def get_tests(config={}): 32 | tests = [] 33 | if os.name == 'nt': 34 | from Crypto.SelfTest.Util import test_winrandom; tests += test_winrandom.get_tests(config=config) 35 | from Crypto.SelfTest.Util import test_number; tests += test_number.get_tests(config=config) 36 | from Crypto.SelfTest.Util import test_Counter; tests += test_Counter.get_tests(config=config) 37 | return tests 38 | 39 | if __name__ == '__main__': 40 | import unittest 41 | suite = lambda: unittest.TestSuite(get_tests()) 42 | unittest.main(defaultTest='suite') 43 | 44 | # vim:set ts=4 sw=4 sts=4 expandtab: 45 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/Util/test_winrandom.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/Util/test_winrandom.py: Self-test for the winrandom module 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Self-test suite for Crypto.Util.winrandom""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import unittest 30 | 31 | class WinRandomImportTest(unittest.TestCase): 32 | def runTest(self): 33 | """winrandom: simple test""" 34 | # Import the winrandom module and try to use it 35 | from Crypto.Util import winrandom 36 | randobj = winrandom.new() 37 | x = randobj.get_bytes(16) 38 | y = randobj.get_bytes(16) 39 | self.assertNotEqual(x, y) 40 | 41 | def get_tests(config={}): 42 | return [WinRandomImportTest()] 43 | 44 | if __name__ == '__main__': 45 | suite = lambda: unittest.TestSuite(get_tests()) 46 | unittest.main(defaultTest='suite') 47 | 48 | # vim:set ts=4 sw=4 sts=4 expandtab: 49 | -------------------------------------------------------------------------------- /executor/libs/Crypto/SelfTest/st_common.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # SelfTest/st_common.py: Common functions for SelfTest modules 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | """Common functions for SelfTest modules""" 26 | 27 | __revision__ = "$Id$" 28 | 29 | import unittest 30 | import binascii 31 | import sys 32 | if sys.version_info[0] == 2 and sys.version_info[1] == 1: 33 | from Crypto.Util.py21compat import * 34 | from Crypto.Util.py3compat import * 35 | 36 | class _list_testloader(unittest.TestLoader): 37 | suiteClass = list 38 | 39 | def list_test_cases(class_): 40 | """Return a list of TestCase instances given a TestCase class 41 | 42 | This is useful when you have defined test* methods on your TestCase class. 43 | """ 44 | return _list_testloader().loadTestsFromTestCase(class_) 45 | 46 | def strip_whitespace(s): 47 | """Remove whitespace from a text or byte string""" 48 | if isinstance(s,str): 49 | return b("".join(s.split())) 50 | else: 51 | return b("").join(s.split()) 52 | 53 | def a2b_hex(s): 54 | """Convert hexadecimal to binary, ignoring whitespace""" 55 | return binascii.a2b_hex(strip_whitespace(s)) 56 | 57 | def b2a_hex(s): 58 | """Convert binary to hexadecimal""" 59 | # For completeness 60 | return binascii.b2a_hex(s) 61 | 62 | # vim:set ts=4 sw=4 sts=4 expandtab: 63 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Signature/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # =================================================================== 4 | # The contents of this file are dedicated to the public domain. To 5 | # the extent that dedication to the public domain is not available, 6 | # everyone is granted a worldwide, perpetual, royalty-free, 7 | # non-exclusive license to exercise all rights associated with the 8 | # contents of this file for any purpose whatsoever. 9 | # No rights are reserved. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 12 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 15 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 16 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | # SOFTWARE. 19 | # =================================================================== 20 | 21 | """Digital signature protocols 22 | 23 | A collection of standardized protocols to carry out digital signatures. 24 | 25 | :undocumented: __revision__, __package__ 26 | """ 27 | 28 | __all__ = [ 'PKCS1_v1_5', 'PKCS1_PSS' ] 29 | __revision__ = "$Id$" 30 | 31 | 32 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Util/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # =================================================================== 4 | # The contents of this file are dedicated to the public domain. To 5 | # the extent that dedication to the public domain is not available, 6 | # everyone is granted a worldwide, perpetual, royalty-free, 7 | # non-exclusive license to exercise all rights associated with the 8 | # contents of this file for any purpose whatsoever. 9 | # No rights are reserved. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 12 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 15 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 16 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | # SOFTWARE. 19 | # =================================================================== 20 | 21 | """Miscellaneous modules 22 | 23 | Contains useful modules that don't belong into any of the 24 | other Crypto.* subpackages. 25 | 26 | Crypto.Util.number Number-theoretic functions (primality testing, etc.) 27 | Crypto.Util.randpool Random number generation 28 | Crypto.Util.RFC1751 Converts between 128-bit keys and human-readable 29 | strings of words. 30 | Crypto.Util.asn1 Minimal support for ASN.1 DER encoding 31 | 32 | """ 33 | 34 | __all__ = ['randpool', 'RFC1751', 'number', 'strxor', 'asn1' ] 35 | 36 | __revision__ = "$Id$" 37 | 38 | -------------------------------------------------------------------------------- /executor/libs/Crypto/Util/_counter.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Util/_counter.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Util/strxor.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/Crypto/Util/strxor.so -------------------------------------------------------------------------------- /executor/libs/Crypto/Util/winrandom.py: -------------------------------------------------------------------------------- 1 | # 2 | # Util/winrandom.py : Stub for Crypto.Random.OSRNG.winrandom 3 | # 4 | # Written in 2008 by Dwayne C. Litzenberger 5 | # 6 | # =================================================================== 7 | # The contents of this file are dedicated to the public domain. To 8 | # the extent that dedication to the public domain is not available, 9 | # everyone is granted a worldwide, perpetual, royalty-free, 10 | # non-exclusive license to exercise all rights associated with the 11 | # contents of this file for any purpose whatsoever. 12 | # No rights are reserved. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | # =================================================================== 23 | 24 | __revision__ = "$Id$" 25 | 26 | from Crypto.Random.OSRNG.winrandom import * 27 | 28 | # vim:set ts=4 sw=4 sts=4 expandtab: 29 | -------------------------------------------------------------------------------- /executor/libs/Crypto/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # =================================================================== 4 | # The contents of this file are dedicated to the public domain. To 5 | # the extent that dedication to the public domain is not available, 6 | # everyone is granted a worldwide, perpetual, royalty-free, 7 | # non-exclusive license to exercise all rights associated with the 8 | # contents of this file for any purpose whatsoever. 9 | # No rights are reserved. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 12 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 15 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 16 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | # SOFTWARE. 19 | # =================================================================== 20 | 21 | """Python Cryptography Toolkit 22 | 23 | A collection of cryptographic modules implementing various algorithms 24 | and protocols. 25 | 26 | Subpackages: 27 | 28 | Crypto.Cipher 29 | Secret-key (AES, DES, ARC4) and public-key encryption (RSA PKCS#1) algorithms 30 | Crypto.Hash 31 | Hashing algorithms (MD5, SHA, HMAC) 32 | Crypto.Protocol 33 | Cryptographic protocols (Chaffing, all-or-nothing transform, key derivation 34 | functions). This package does not contain any network protocols. 35 | Crypto.PublicKey 36 | Public-key encryption and signature algorithms (RSA, DSA) 37 | Crypto.Signature 38 | Public-key signature algorithms (RSA PKCS#1) 39 | Crypto.Util 40 | Various useful modules and functions (long-to-string conversion, random number 41 | generation, number theoretic functions) 42 | """ 43 | 44 | __all__ = ['Cipher', 'Hash', 'Protocol', 'PublicKey', 'Util', 'Signature'] 45 | 46 | __version__ = '2.6.1' # See also below and setup.py 47 | __revision__ = "$Id$" 48 | 49 | # New software should look at this instead of at __version__ above. 50 | version_info = (2, 6, 1, 'final', 0) # See also above and setup.py 51 | 52 | -------------------------------------------------------------------------------- /executor/libs/Crypto/pct_warnings.py: -------------------------------------------------------------------------------- 1 | # -*- coding: ascii -*- 2 | # 3 | # pct_warnings.py : PyCrypto warnings file 4 | # 5 | # Written in 2008 by Dwayne C. Litzenberger 6 | # 7 | # =================================================================== 8 | # The contents of this file are dedicated to the public domain. To 9 | # the extent that dedication to the public domain is not available, 10 | # everyone is granted a worldwide, perpetual, royalty-free, 11 | # non-exclusive license to exercise all rights associated with the 12 | # contents of this file for any purpose whatsoever. 13 | # No rights are reserved. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # =================================================================== 24 | 25 | # 26 | # Base classes. All our warnings inherit from one of these in order to allow 27 | # the user to specifically filter them. 28 | # 29 | 30 | class CryptoWarning(Warning): 31 | """Base class for PyCrypto warnings""" 32 | 33 | class CryptoDeprecationWarning(DeprecationWarning, CryptoWarning): 34 | """Base PyCrypto DeprecationWarning class""" 35 | 36 | class CryptoRuntimeWarning(RuntimeWarning, CryptoWarning): 37 | """Base PyCrypto RuntimeWarning class""" 38 | 39 | # 40 | # Warnings that we might actually use 41 | # 42 | 43 | class RandomPool_DeprecationWarning(CryptoDeprecationWarning): 44 | """Issued when Crypto.Util.randpool.RandomPool is instantiated.""" 45 | 46 | class ClockRewindWarning(CryptoRuntimeWarning): 47 | """Warning for when the system clock moves backwards.""" 48 | 49 | class GetRandomNumber_DeprecationWarning(CryptoDeprecationWarning): 50 | """Issued when Crypto.Util.number.getRandomNumber is invoked.""" 51 | 52 | class PowmInsecureWarning(CryptoRuntimeWarning): 53 | """Warning for when _fastmath is built without mpz_powm_sec""" 54 | 55 | # By default, we want this warning to be shown every time we compensate for 56 | # clock rewinding. 57 | import warnings as _warnings 58 | _warnings.filterwarnings('always', category=ClockRewindWarning, append=1) 59 | 60 | # vim:set ts=4 sw=4 sts=4 expandtab: 61 | -------------------------------------------------------------------------------- /executor/libs/ecdsa/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ["curves", "der", "ecdsa", "ellipticcurve", "keys", "numbertheory", 2 | "test_pyecdsa", "util", "six"] 3 | from .keys import SigningKey, VerifyingKey, BadSignatureError, BadDigestError 4 | from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1 5 | 6 | _hush_pyflakes = [SigningKey, VerifyingKey, BadSignatureError, BadDigestError, 7 | NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1] 8 | del _hush_pyflakes 9 | 10 | # This code comes from http://github.com/warner/python-ecdsa 11 | 12 | from ._version import get_versions 13 | __version__ = get_versions()['version'] 14 | del get_versions 15 | -------------------------------------------------------------------------------- /executor/libs/ecdsa/_version.py: -------------------------------------------------------------------------------- 1 | 2 | # This file was generated by 'versioneer.py' (0.12) from 3 | # revision-control system data, or from the parent directory name of an 4 | # unpacked source archive. Distribution tarballs contain a pre-generated copy 5 | # of this file. 6 | 7 | version_version = '0.13' 8 | version_full = '5a6fc047222cf21ad89f6cbf8782d0f1e3ddacda' 9 | def get_versions(default={}, verbose=False): 10 | return {'version': version_version, 'full': version_full} 11 | 12 | -------------------------------------------------------------------------------- /executor/libs/ecdsa/curves.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | 3 | from . import der, ecdsa 4 | 5 | class UnknownCurveError(Exception): 6 | pass 7 | 8 | def orderlen(order): 9 | return (1+len("%x"%order))//2 # bytes 10 | 11 | # the NIST curves 12 | class Curve: 13 | def __init__(self, name, curve, generator, oid, openssl_name=None): 14 | self.name = name 15 | self.openssl_name = openssl_name # maybe None 16 | self.curve = curve 17 | self.generator = generator 18 | self.order = generator.order() 19 | self.baselen = orderlen(self.order) 20 | self.verifying_key_length = 2*self.baselen 21 | self.signature_length = 2*self.baselen 22 | self.oid = oid 23 | self.encoded_oid = der.encode_oid(*oid) 24 | 25 | NIST192p = Curve("NIST192p", ecdsa.curve_192, ecdsa.generator_192, 26 | (1, 2, 840, 10045, 3, 1, 1), "prime192v1") 27 | NIST224p = Curve("NIST224p", ecdsa.curve_224, ecdsa.generator_224, 28 | (1, 3, 132, 0, 33), "secp224r1") 29 | NIST256p = Curve("NIST256p", ecdsa.curve_256, ecdsa.generator_256, 30 | (1, 2, 840, 10045, 3, 1, 7), "prime256v1") 31 | NIST384p = Curve("NIST384p", ecdsa.curve_384, ecdsa.generator_384, 32 | (1, 3, 132, 0, 34), "secp384r1") 33 | NIST521p = Curve("NIST521p", ecdsa.curve_521, ecdsa.generator_521, 34 | (1, 3, 132, 0, 35), "secp521r1") 35 | SECP256k1 = Curve("SECP256k1", ecdsa.curve_secp256k1, ecdsa.generator_secp256k1, 36 | (1, 3, 132, 0, 10), "secp256k1") 37 | 38 | curves = [NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1] 39 | 40 | def find_curve(oid_curve): 41 | for c in curves: 42 | if c.oid == oid_curve: 43 | return c 44 | raise UnknownCurveError("I don't know about the curve with oid %s." 45 | "I only know about these: %s" % 46 | (oid_curve, [c.name for c in curves])) 47 | -------------------------------------------------------------------------------- /executor/libs/paramiko/_version.py: -------------------------------------------------------------------------------- 1 | __version_info__ = (1, 16, 0) 2 | __version__ = '.'.join(map(str, __version_info__)) 3 | -------------------------------------------------------------------------------- /executor/libs/paramiko/compress.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2003-2007 Robey Pointer 2 | # 3 | # This file is part of paramiko. 4 | # 5 | # Paramiko is free software; you can redistribute it and/or modify it under the 6 | # terms of the GNU Lesser General Public License as published by the Free 7 | # Software Foundation; either version 2.1 of the License, or (at your option) 8 | # any later version. 9 | # 10 | # Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY 11 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 | # details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public License 16 | # along with Paramiko; if not, write to the Free Software Foundation, Inc., 17 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 18 | 19 | """ 20 | Compression implementations for a Transport. 21 | """ 22 | 23 | import zlib 24 | 25 | 26 | class ZlibCompressor (object): 27 | def __init__(self): 28 | self.z = zlib.compressobj(9) 29 | 30 | def __call__(self, data): 31 | return self.z.compress(data) + self.z.flush(zlib.Z_FULL_FLUSH) 32 | 33 | 34 | class ZlibDecompressor (object): 35 | def __init__(self): 36 | self.z = zlib.decompressobj() 37 | 38 | def __call__(self, data): 39 | return self.z.decompress(data) 40 | -------------------------------------------------------------------------------- /executor/libs/paramiko/kex_group14.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 Torsten Landschoff 2 | # 3 | # This file is part of paramiko. 4 | # 5 | # Paramiko is free software; you can redistribute it and/or modify it under the 6 | # terms of the GNU Lesser General Public License as published by the Free 7 | # Software Foundation; either version 2.1 of the License, or (at your option) 8 | # any later version. 9 | # 10 | # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 11 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 | # details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public License 16 | # along with Paramiko; if not, write to the Free Software Foundation, Inc., 17 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 18 | 19 | """ 20 | Standard SSH key exchange ("kex" if you wanna sound cool). Diffie-Hellman of 21 | 2048 bit key halves, using a known "p" prime and "g" generator. 22 | """ 23 | 24 | from paramiko.kex_group1 import KexGroup1 25 | 26 | 27 | class KexGroup14(KexGroup1): 28 | 29 | # http://tools.ietf.org/html/rfc3526#section-3 30 | P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF 31 | G = 2 32 | 33 | name = 'diffie-hellman-group14-sha1' 34 | -------------------------------------------------------------------------------- /executor/libs/paramiko/resource.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2003-2007 Robey Pointer 2 | # 3 | # This file is part of paramiko. 4 | # 5 | # Paramiko is free software; you can redistribute it and/or modify it under the 6 | # terms of the GNU Lesser General Public License as published by the Free 7 | # Software Foundation; either version 2.1 of the License, or (at your option) 8 | # any later version. 9 | # 10 | # Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY 11 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 | # details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public License 16 | # along with Paramiko; if not, write to the Free Software Foundation, Inc., 17 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 18 | 19 | """ 20 | Resource manager. 21 | """ 22 | 23 | import weakref 24 | 25 | 26 | class ResourceManager (object): 27 | """ 28 | A registry of objects and resources that should be closed when those 29 | objects are deleted. 30 | 31 | This is meant to be a safer alternative to Python's ``__del__`` method, 32 | which can cause reference cycles to never be collected. Objects registered 33 | with the ResourceManager can be collected but still free resources when 34 | they die. 35 | 36 | Resources are registered using `register`, and when an object is garbage 37 | collected, each registered resource is closed by having its ``close()`` 38 | method called. Multiple resources may be registered per object, but a 39 | resource will only be closed once, even if multiple objects register it. 40 | (The last object to register it wins.) 41 | """ 42 | 43 | def __init__(self): 44 | self._table = {} 45 | 46 | def register(self, obj, resource): 47 | """ 48 | Register a resource to be closed with an object is collected. 49 | 50 | When the given ``obj`` is garbage-collected by the Python interpreter, 51 | the ``resource`` will be closed by having its ``close()`` method called. 52 | Any exceptions are ignored. 53 | 54 | :param object obj: the object to track 55 | :param object resource: 56 | the resource to close when the object is collected 57 | """ 58 | def callback(ref): 59 | try: 60 | resource.close() 61 | except: 62 | pass 63 | del self._table[id(resource)] 64 | 65 | # keep the weakref in a table so it sticks around long enough to get 66 | # its callback called. :) 67 | self._table[id(resource)] = weakref.ref(obj, callback) 68 | 69 | 70 | # singleton 71 | ResourceManager = ResourceManager() 72 | -------------------------------------------------------------------------------- /executor/libs/scapy/__init__.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | from __future__ import with_statement 7 | 8 | """ 9 | Scapy: create, send, sniff, dissect and manipulate network packets. 10 | 11 | Usable either from an interactive console or as a Python library. 12 | http://www.secdev.org/projects/scapy 13 | """ 14 | 15 | import os 16 | import re 17 | import subprocess 18 | 19 | 20 | _SCAPY_PKG_DIR = os.path.dirname(__file__) 21 | 22 | def _version_from_git_describe(): 23 | """ 24 | Read the version from ``git describe``. It returns the latest tag with an 25 | optional suffix if the current directory is not exactly on the tag. 26 | 27 | Example:: 28 | 29 | $ git describe --always 30 | v2.3.2-346-g164a52c075c8 31 | 32 | The tag prefix (``v``) and the git commit sha1 (``-g164a52c075c8``) are 33 | removed if present. 34 | 35 | If the current directory is not exactly on the tag, a ``.devN`` suffix is 36 | appended where N is the number of commits made after the last tag. 37 | 38 | Example:: 39 | 40 | >>> _version_from_git_describe() 41 | '2.3.2.dev346' 42 | """ 43 | p = subprocess.Popen(['git', 'describe', '--always'], cwd=_SCAPY_PKG_DIR, 44 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) 45 | 46 | out, err = p.communicate() 47 | 48 | if p.returncode == 0: 49 | tag = out.strip() 50 | match = re.match(r'^v?(.+?)-(\d+)-g[a-f0-9]+$', tag) 51 | if match: 52 | # remove the 'v' prefix and add a '.devN' suffix 53 | return '%s.dev%s' % (match.group(1), match.group(2)) 54 | else: 55 | # just remove the 'v' prefix 56 | return re.sub(r'^v', '', tag) 57 | else: 58 | raise subprocess.CalledProcessError(p.returncode, err) 59 | 60 | def _version(): 61 | version_file = os.path.join(_SCAPY_PKG_DIR, 'VERSION') 62 | try: 63 | tag = _version_from_git_describe() 64 | # successfully read the tag from git, write it in VERSION for 65 | # installation and/or archive generation. 66 | with open(version_file, 'w') as f: 67 | f.write(tag) 68 | return tag 69 | except: 70 | # failed to read the tag from git, try to read it from a VERSION file 71 | try: 72 | with open(version_file, 'r') as f: 73 | tag = f.read() 74 | return tag 75 | except: 76 | return 'unknown.version' 77 | 78 | VERSION = _version() 79 | 80 | if __name__ == "__main__": 81 | from scapy.main import interact 82 | interact() 83 | -------------------------------------------------------------------------------- /executor/libs/scapy/all.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Aggregate top level objects from all Scapy modules. 8 | """ 9 | 10 | from scapy.base_classes import * 11 | from scapy.config import * 12 | from scapy.dadict import * 13 | from scapy.data import * 14 | from scapy.error import * 15 | from scapy.themes import * 16 | from scapy.arch import * 17 | 18 | from scapy.plist import * 19 | from scapy.fields import * 20 | from scapy.packet import * 21 | from scapy.asn1fields import * 22 | from scapy.asn1packet import * 23 | 24 | from scapy.utils import * 25 | from scapy.route import * 26 | if conf.ipv6_enabled: 27 | from scapy.utils6 import * 28 | from scapy.route6 import * 29 | from scapy.sendrecv import * 30 | from scapy.supersocket import * 31 | from scapy.volatile import * 32 | from scapy.as_resolvers import * 33 | 34 | from scapy.ansmachine import * 35 | from scapy.automaton import * 36 | from scapy.autorun import * 37 | 38 | from scapy.main import * 39 | 40 | from scapy.layers.all import * 41 | 42 | from scapy.asn1.asn1 import * 43 | from scapy.asn1.ber import * 44 | from scapy.asn1.mib import * 45 | 46 | from scapy.pipetool import * 47 | from scapy.scapypipes import * 48 | -------------------------------------------------------------------------------- /executor/libs/scapy/arch/bsd.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Support for BSD-like operating systems such as FreeBSD, OpenBSD and Mac OS X. 8 | """ 9 | 10 | LOOPBACK_NAME = "lo0" 11 | -------------------------------------------------------------------------------- /executor/libs/scapy/arch/common.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Functions common to different architectures 8 | """ 9 | 10 | import socket 11 | from fcntl import ioctl 12 | import struct 13 | 14 | 15 | def get_if(iff, cmd): 16 | """Ease SIOCGIF* ioctl calls""" 17 | 18 | sck = socket.socket() 19 | ifreq = ioctl(sck, cmd, struct.pack("16s16x", iff)) 20 | sck.close() 21 | return ifreq 22 | -------------------------------------------------------------------------------- /executor/libs/scapy/arch/solaris.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Customization for the Solaris operation system. 8 | """ 9 | 10 | # IPPROTO_GRE is missing on Solaris 11 | import socket 12 | socket.IPPROTO_GRE = 47 13 | 14 | LOOPBACK_NAME="lo0" 15 | 16 | from scapy.arch.unix import * 17 | -------------------------------------------------------------------------------- /executor/libs/scapy/asn1/__init__.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Package holding ASN.1 related modules. 8 | """ 9 | 10 | # We do not import mib.py because it is more bound to scapy and 11 | # less prone to be used in a standalone fashion 12 | __all__ = ["asn1","ber"] 13 | -------------------------------------------------------------------------------- /executor/libs/scapy/asn1packet.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Packet holding data in Abstract Syntax Notation (ASN.1). 8 | """ 9 | 10 | from scapy.base_classes import Packet_metaclass 11 | from scapy.packet import Packet 12 | 13 | class ASN1Packet_metaclass(Packet_metaclass): 14 | def __new__(cls, name, bases, dct): 15 | if dct["ASN1_root"] is not None: 16 | dct["fields_desc"] = dct["ASN1_root"].get_fields_list() 17 | return super(ASN1Packet_metaclass, cls).__new__(cls, name, bases, dct) 18 | 19 | class ASN1_Packet(Packet): 20 | __metaclass__ = ASN1Packet_metaclass 21 | ASN1_root = None 22 | ASN1_codec = None 23 | def self_build(self): 24 | if self.raw_packet_cache is not None: 25 | return self.raw_packet_cache 26 | return self.ASN1_root.build(self) 27 | def do_dissect(self, x): 28 | return self.ASN1_root.dissect(self, x) 29 | 30 | 31 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/__init__.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Package of contrib modules that have to be loaded explicitly. 8 | """ 9 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/avs.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # http://trac.secdev.org/scapy/ticket/82 4 | 5 | # scapy.contrib.description = AVS WLAN Monitor Header 6 | # scapy.contrib.status = loads 7 | 8 | from scapy.packet import * 9 | from scapy.fields import * 10 | from scapy.layers.dot11 import * 11 | 12 | AVSWLANPhyType = { 0 : "Unknown", 13 | 1 : "FHSS 802.11 '97", 14 | 2 : "DSSS 802.11 '97", 15 | 3 : "IR Baseband", 16 | 4 : "DSSS 802.11b", 17 | 5 : "PBCC 802.11b", 18 | 6 : "OFDM 802.11g", 19 | 7 : "PBCC 802.11g", 20 | 8 : "OFDM 802.11a" } 21 | 22 | AVSWLANEncodingType = { 0 : "Unknown", 23 | 1 : "CCK", 24 | 2 : "PBCC", 25 | 3 : "OFDM"} 26 | 27 | AVSWLANSSIType = { 0 : "None", 28 | 1 : "Normalized RSSI", 29 | 2 : "dBm", 30 | 3 : "Raw RSSI"} 31 | 32 | AVSWLANPreambleType = { 0 : "Unknown", 33 | 1 : "Short", 34 | 2 : "Long" } 35 | 36 | 37 | class AVSWLANHeader(Packet): 38 | """ iwpriv eth1 set_prismhdr 1 """ 39 | name = "AVS WLAN Monitor Header" 40 | fields_desc = [ IntField("version",1), 41 | IntField("len",64), 42 | LongField("mactime",0), 43 | LongField("hosttime",0), 44 | IntEnumField("phytype",0, AVSWLANPhyType), 45 | IntField("channel",0), 46 | IntField("datarate",0), 47 | IntField("antenna",0), 48 | IntField("priority",0), 49 | IntEnumField("ssi_type",0, AVSWLANSSIType), 50 | SignedIntField("ssi_signal",0), 51 | SignedIntField("ssi_noise",0), 52 | IntEnumField("preamble",0, AVSWLANPreambleType), 53 | IntEnumField("encoding",0, AVSWLANEncodingType), 54 | ] 55 | 56 | bind_layers(AVSWLANHeader, Dot11) 57 | 58 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/carp.py: -------------------------------------------------------------------------------- 1 | 2 | # scapy.contrib.description = CARP 3 | # scapy.contrib.status = loads 4 | 5 | import struct, hmac, hashlib 6 | 7 | from scapy.packet import * 8 | from scapy.layers.inet import IP 9 | from scapy.fields import BitField, ByteField, XShortField, IntField, XIntField 10 | from scapy.utils import checksum, inet_aton 11 | 12 | class CARP(Packet): 13 | name = "CARP" 14 | fields_desc = [ BitField("version", 4, 4), 15 | BitField("type", 4, 4), 16 | ByteField("vhid", 1), 17 | ByteField("advskew", 0), 18 | ByteField("authlen", 0), 19 | ByteField("demotion", 0), 20 | ByteField("advbase", 0), 21 | XShortField("chksum", 0), 22 | XIntField("counter1", 0), 23 | XIntField("counter2", 0), 24 | XIntField("hmac1", 0), 25 | XIntField("hmac2", 0), 26 | XIntField("hmac3", 0), 27 | XIntField("hmac4", 0), 28 | XIntField("hmac5", 0) 29 | ] 30 | 31 | def post_build(self, pkt, pay): 32 | if self.chksum == None: 33 | pkt = pkt[:6] + struct.pack("!H", checksum(pkt)) + pkt[8:] 34 | 35 | return pkt 36 | 37 | def build_hmac_sha1(pkt, pw = '\0' * 20, ip4l=None, ip6l=None): 38 | if ip4l is None: 39 | ip4l = [] 40 | if ip6l is None: 41 | ip6l = [] 42 | if not pkt.haslayer(CARP): 43 | return None 44 | 45 | p = pkt[CARP] 46 | h = hmac.new(pw, digestmod = hashlib.sha1) 47 | # XXX: this is a dirty hack. it needs to pack version and type into a single 8bit field 48 | h.update('\x21') 49 | # XXX: mac addy if different from special link layer. comes before vhid 50 | h.update(struct.pack('!B', p.vhid)) 51 | 52 | sl = [] 53 | for i in ip4l: 54 | # sort ips from smallest to largest 55 | sl.append(inet_aton(i)) 56 | sl.sort() 57 | 58 | for i in sl: 59 | h.update(i) 60 | 61 | # XXX: do ip6l sorting 62 | 63 | return h.digest() 64 | 65 | """ 66 | XXX: Usually CARP is multicast to 224.0.0.18 but because of virtual setup, it'll 67 | be unicast between nodes. Uncomment the following line for normal use 68 | bind_layers(IP, CARP, proto=112, dst='224.0.0.18') 69 | """ 70 | bind_layers(IP, CARP, proto=112) 71 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/chdlc.py: -------------------------------------------------------------------------------- 1 | # http://trac.secdev.org/scapy/ticket/88 2 | 3 | # scapy.contrib.description = Cisco HDLC and SLARP 4 | # scapy.contrib.status = loads 5 | 6 | # This layer is based on information from http://www.nethelp.no/net/cisco-hdlc.txt 7 | 8 | from scapy.packet import * 9 | from scapy.fields import * 10 | from scapy.layers.l2 import * 11 | from scapy.layers.inet import * 12 | from scapy.layers.inet6 import * 13 | 14 | class CHDLC(Packet): 15 | name = "Cisco HDLC" 16 | fields_desc = [ ByteEnumField("address", 0x0f, {0x0f : "unicast", 0x8f :"multicast"}), 17 | ByteField("control", 0), 18 | XShortField("proto", 0x0800)] 19 | 20 | class SLARP(Packet): 21 | name = "SLARP" 22 | fields_desc = [ IntEnumField("type", 2, {0 : "request", 1 : "reply", 2 :"line keepalive"}), 23 | ConditionalField(IPField("address", "192.168.0.1"), 24 | lambda pkt : pkt.type == 0 or pkt.type == 1), 25 | ConditionalField(IPField("mask", "255.255.255.0"), 26 | lambda pkt : pkt.type == 0 or pkt.type == 1), 27 | ConditionalField(XShortField("unused", 0), 28 | lambda pkt : pkt.type == 0 or pkt.type == 1), 29 | ConditionalField(IntField("mysequence", 0), 30 | lambda pkt : pkt.type == 2), 31 | ConditionalField(IntField("yoursequence", 0), 32 | lambda pkt : pkt.type == 2), 33 | ConditionalField(XShortField("reliability", 0xffff), 34 | lambda pkt : pkt.type == 2)] 35 | 36 | bind_layers( CHDLC, Dot3, proto=0x6558) 37 | bind_layers( CHDLC, IP, proto=0x800) 38 | bind_layers( CHDLC, IPv6, proto=0x86dd) 39 | bind_layers( CHDLC, SLARP, proto=0x8035) 40 | bind_layers( CHDLC, STP, proto=0x4242) 41 | 42 | conf.l2types.register(104, CHDLC) 43 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/etherip.py: -------------------------------------------------------------------------------- 1 | 2 | # http://trac.secdev.org/scapy/ticket/297 3 | 4 | # scapy.contrib.description = EtherIP 5 | # scapy.contrib.status = loads 6 | 7 | from scapy.fields import BitField 8 | from scapy.packet import Packet, bind_layers 9 | from scapy.layers.inet import IP 10 | from scapy.layers.l2 import Ether 11 | 12 | class EtherIP(Packet): 13 | name = "EtherIP / RFC 3378" 14 | fields_desc = [ BitField("version", 3, 4), 15 | BitField("reserved", 0, 12)] 16 | 17 | bind_layers( IP, EtherIP, frag=0, proto=0x61) 18 | bind_layers( EtherIP, Ether) 19 | 20 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/mpls.py: -------------------------------------------------------------------------------- 1 | # http://trac.secdev.org/scapy/ticket/31 2 | 3 | # scapy.contrib.description = MPLS 4 | # scapy.contrib.status = loads 5 | 6 | from scapy.packet import Packet, bind_layers, Padding 7 | from scapy.fields import BitField,ByteField 8 | from scapy.layers.inet import IP 9 | from scapy.layers.inet6 import IPv6 10 | from scapy.layers.l2 import Ether, GRE 11 | 12 | class MPLS(Packet): 13 | name = "MPLS" 14 | fields_desc = [ BitField("label", 3, 20), 15 | BitField("cos", 0, 3), 16 | BitField("s", 1, 1), 17 | ByteField("ttl", 0) ] 18 | 19 | def guess_payload_class(self, payload): 20 | if len(payload) >= 1: 21 | ip_version = (ord(payload[0]) >> 4) & 0xF 22 | if ip_version == 4: 23 | return IP 24 | elif ip_version == 6: 25 | return IPv6 26 | return Padding 27 | 28 | bind_layers(Ether, MPLS, type=0x8847) 29 | bind_layers(GRE, MPLS, proto=0x8847) 30 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/pnio.py: -------------------------------------------------------------------------------- 1 | # This file is part of Scapy 2 | # Scapy is free software: you can redistribute it and/or modify 3 | # it under the terms of the GNU General Public License as published by 4 | # the Free Software Foundation, either version 2 of the License, or 5 | # any later version. 6 | # 7 | # Scapy is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with Scapy. If not, see . 14 | 15 | # Copyright (C) 2016 Gauthier Sebaux 16 | 17 | # scapy.contrib.description = ProfinetIO base layer 18 | # scapy.contrib.status = loads 19 | 20 | """ 21 | A simple and non exhaustive Profinet IO layer for scapy 22 | """ 23 | 24 | # Scapy imports 25 | from scapy.all import Packet, bind_layers, Ether, UDP 26 | from scapy.fields import XShortEnumField 27 | 28 | # Some constants 29 | PNIO_FRAME_IDS = { 30 | 0x0020:"PTCP-RTSyncPDU-followup", 31 | 0x0080:"PTCP-RTSyncPDU", 32 | 0xFC01:"Alarm High", 33 | 0xFE01:"Alarm Low", 34 | 0xFEFC:"DCP-Hello-Req", 35 | 0xFEFD:"DCP-Get-Set", 36 | 0xFEFE:"DCP-Identify-ReqPDU", 37 | 0xFEFF:"DCP-Identify-ResPDU", 38 | 0xFF00:"PTCP-AnnouncePDU", 39 | 0xFF20:"PTCP-FollowUpPDU", 40 | 0xFF40:"PTCP-DelayReqPDU", 41 | 0xFF41:"PTCP-DelayResPDU-followup", 42 | 0xFF42:"PTCP-DelayFuResPDU", 43 | 0xFF43:"PTCP-DelayResPDU", 44 | } 45 | for i in xrange(0x0100, 0x1000): 46 | PNIO_FRAME_IDS[i] = "RT_CLASS_3" 47 | for i in xrange(0x8000, 0xC000): 48 | PNIO_FRAME_IDS[i] = "RT_CLASS_1" 49 | for i in xrange(0xC000, 0xFC00): 50 | PNIO_FRAME_IDS[i] = "RT_CLASS_UDP" 51 | for i in xrange(0xFF80, 0xFF90): 52 | PNIO_FRAME_IDS[i] = "FragmentationFrameID" 53 | 54 | ################# 55 | ## PROFINET IO ## 56 | ################# 57 | 58 | class ProfinetIO(Packet): 59 | """Basic PROFINET IO dispatcher""" 60 | fields_desc = [XShortEnumField("frameID", 0, PNIO_FRAME_IDS)] 61 | overload_fields = { 62 | Ether: {"type": 0x8892}, 63 | UDP: {"dport": 0x8892}, 64 | } 65 | 66 | def guess_payload_class(self, payload): 67 | # For frameID in the RT_CLASS_* range, use the RTC packet as payload 68 | if (self.frameID >= 0x0100 and self.frameID < 0x1000) or \ 69 | (self.frameID >= 0x8000 and self.frameID < 0xFC00): 70 | from scapy.contrib.pnio_rtc import PNIORealTime 71 | return PNIORealTime 72 | else: 73 | return Packet.guess_payload_class(self, payload) 74 | 75 | bind_layers(Ether, ProfinetIO, type=0x8892) 76 | bind_layers(UDP, ProfinetIO, dport=0x8892) 77 | 78 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/ripng.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # http://trac.secdev.org/scapy/ticket/301 4 | 5 | # scapy.contrib.description = RIPng 6 | # scapy.contrib.status = loads 7 | 8 | from scapy.packet import * 9 | from scapy.fields import * 10 | from scapy.layers.inet import UDP 11 | from scapy.layers.inet6 import * 12 | 13 | class RIPng(Packet): 14 | name = "RIPng header" 15 | fields_desc = [ 16 | ByteEnumField("cmd", 1, {1 : "req", 2 : "resp"}), 17 | ByteField("ver", 1), 18 | ShortField("null", 0), 19 | ] 20 | 21 | class RIPngEntry(Packet): 22 | name = "RIPng entry" 23 | fields_desc = [ 24 | ConditionalField(IP6Field("prefix", "::"), 25 | lambda pkt: pkt.metric != 255), 26 | ConditionalField(IP6Field("nexthop", "::"), 27 | lambda pkt: pkt.metric == 255), 28 | ShortField("routetag", 0), 29 | ByteField("prefixlen", 0), 30 | ByteEnumField("metric", 1, {16 : "Unreach", 31 | 255 : "next-hop entry"}) 32 | ] 33 | 34 | bind_layers(UDP, RIPng, sport=521, dport=521) 35 | bind_layers(RIPng, RIPngEntry) 36 | bind_layers(RIPngEntry, RIPngEntry) 37 | 38 | if __name__ == "__main__": 39 | from scapy.main import interact 40 | interact(mydict=globals(), mybanner="RIPng") 41 | 42 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/spbm.py: -------------------------------------------------------------------------------- 1 | # IEEE 802.1aq - Shorest Path Bridging Mac-in-mac (SPBM): 2 | # Ethernet based link state protocol that enables Layer 2 Unicast, Layer 2 Multicast, Layer 3 Unicast, and Layer 3 Multicast virtualized services 3 | # https://en.wikipedia.org/wiki/IEEE_802.1aq 4 | # Modeled after the scapy VXLAN contribution 5 | # 6 | ############################################################# 7 | # Example SPB Frame Creation 8 | # 9 | # Note the outer Dot1Q Ethertype marking (0x88e7) 10 | ############################################################# 11 | # backboneEther = Ether(dst='00:bb:00:00:90:00', src='00:bb:00:00:40:00', type=0x8100) 12 | # backboneDot1Q = Dot1Q(vlan=4051,type=0x88e7) 13 | # backboneServiceID = SPBM(prio=1,isid=20011) 14 | # customerEther = Ether(dst='00:1b:4f:5e:ca:00',src='00:00:00:00:00:01',type=0x8100) 15 | # customerDot1Q = Dot1Q(prio=1,vlan=11,type=0x0800) 16 | # customerIP = IP(src='10.100.11.10',dst='10.100.12.10',id=0x0629,len=106) 17 | # customerUDP = UDP(sport=1024,dport=1025,chksum=0,len=86) 18 | # 19 | # spb_example = backboneEther/backboneDot1Q/backboneServiceID/customerEther/customerDot1Q/customerIP/customerUDP/"Payload" 20 | 21 | from scapy.packet import Packet, bind_layers 22 | from scapy.fields import * 23 | from scapy.layers.l2 import Ether, Dot1Q 24 | 25 | class SPBM(Packet): 26 | name = "SPBM" 27 | fields_desc = [ BitField("prio", 0, 3), 28 | BitField("dei", 0, 1), 29 | BitField("nca", 0, 1), 30 | BitField("res1", 0, 1), 31 | BitField("res2", 0, 2), 32 | ThreeBytesField("isid", 0)] 33 | 34 | def mysummary(self): 35 | return self.sprintf("SPBM (isid=%SPBM.isid%") 36 | 37 | bind_layers(Dot1Q, SPBM, type=0x88e7) 38 | bind_layers(SPBM, Ether) 39 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/vqp.py: -------------------------------------------------------------------------------- 1 | 2 | # http://trac.secdev.org/scapy/ticket/147 3 | 4 | # scapy.contrib.description = VLAN Query Protocol 5 | # scapy.contrib.status = loads 6 | 7 | from scapy.packet import * 8 | from scapy.fields import * 9 | from scapy.layers.inet import UDP 10 | 11 | class VQP(Packet): 12 | name = "VQP" 13 | fields_desc = [ 14 | ByteField("const", 1), 15 | ByteEnumField("type", 1, { 16 | 1:"requestPort", 2:"responseVLAN", 17 | 3:"requestReconfirm", 4:"responseReconfirm" 18 | }), 19 | ByteEnumField("errorcodeaction", 0, { 20 | 0:"none",3:"accessDenied", 21 | 4:"shutdownPort", 5:"wrongDomain" 22 | }), 23 | ByteEnumField("unknown", 2, { 24 | 2:"inGoodResponse", 6:"inRequests" 25 | }), 26 | IntField("seq",0), 27 | ] 28 | 29 | class VQPEntry(Packet): 30 | name = "VQPEntry" 31 | fields_desc = [ 32 | IntEnumField("datatype", 0, { 33 | 3073:"clientIPAddress", 3074:"portName", 34 | 3075:"VLANName", 3076:"Domain", 3077:"ethernetPacket", 35 | 3078:"ReqMACAddress", 3079:"unknown", 36 | 3080:"ResMACAddress" 37 | }), 38 | FieldLenField("len", None), 39 | ConditionalField(IPField("datatom", "0.0.0.0"), 40 | lambda p:p.datatype==3073), 41 | ConditionalField(MACField("data", "00:00:00:00:00:00"), 42 | lambda p:p.datatype==3078), 43 | ConditionalField(MACField("data", "00:00:00:00:00:00"), 44 | lambda p:p.datatype==3080), 45 | ConditionalField(StrLenField("data", None, 46 | length_from=lambda p:p.len), 47 | lambda p:p.datatype not in [3073, 3078, 3080]), 48 | ] 49 | def post_build(self, p, pay): 50 | if self.len is None: 51 | l = len(p.data) 52 | p = p[:2]+struct.pack("!H",l)+p[4:] 53 | return p 54 | 55 | bind_layers(UDP, VQP, sport=1589) 56 | bind_layers(UDP, VQP, dport=1589) 57 | bind_layers(VQP, VQPEntry, ) 58 | bind_layers(VQPEntry, VQPEntry, ) 59 | -------------------------------------------------------------------------------- /executor/libs/scapy/contrib/wpa_eapol.py: -------------------------------------------------------------------------------- 1 | 2 | # http://trac.secdev.org/scapy/ticket/104 3 | 4 | # scapy.contrib.description = WPA EAPOL dissector 5 | # scapy.contrib.status = loads 6 | 7 | from scapy.packet import * 8 | from scapy.fields import * 9 | from scapy.layers.l2 import * 10 | 11 | class WPA_key(Packet): 12 | name = "WPA_key" 13 | fields_desc = [ ByteField("descriptor_type", 1), 14 | ShortField("key_info",0), 15 | LenField("len", None, "H"), 16 | StrFixedLenField("replay_counter", "", 8), 17 | StrFixedLenField("nonce", "", 32), 18 | StrFixedLenField("key_iv", "", 16), 19 | StrFixedLenField("wpa_key_rsc", "", 8), 20 | StrFixedLenField("wpa_key_id", "", 8), 21 | StrFixedLenField("wpa_key_mic", "", 16), 22 | LenField("wpa_key_length", None, "H"), 23 | StrLenField("wpa_key", "", length_from=lambda pkt:pkt.wpa_key_length) ] 24 | def extract_padding(self, s): 25 | l = self.len 26 | return s[:l],s[l:] 27 | def hashret(self): 28 | return chr(self.type)+self.payload.hashret() 29 | def answers(self, other): 30 | if isinstance(other,WPA_key): 31 | return 1 32 | return 0 33 | 34 | 35 | bind_layers( EAPOL, WPA_key, type=3) 36 | -------------------------------------------------------------------------------- /executor/libs/scapy/error.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Logging subsystem and basic exception class. 8 | """ 9 | 10 | ############################# 11 | ##### Logging subsystem ##### 12 | ############################# 13 | 14 | class Scapy_Exception(Exception): 15 | pass 16 | 17 | import logging,traceback,time 18 | 19 | class ScapyFreqFilter(logging.Filter): 20 | def __init__(self): 21 | logging.Filter.__init__(self) 22 | self.warning_table = {} 23 | def filter(self, record): 24 | from scapy.config import conf 25 | wt = conf.warning_threshold 26 | if wt > 0: 27 | stk = traceback.extract_stack() 28 | caller=None 29 | for f,l,n,c in stk: 30 | if n == 'warning': 31 | break 32 | caller = l 33 | tm,nb = self.warning_table.get(caller, (0,0)) 34 | ltm = time.time() 35 | if ltm-tm > wt: 36 | tm = ltm 37 | nb = 0 38 | else: 39 | if nb < 2: 40 | nb += 1 41 | if nb == 2: 42 | record.msg = "more "+record.msg 43 | else: 44 | return 0 45 | self.warning_table[caller] = (tm,nb) 46 | return 1 47 | 48 | try: 49 | from logging import NullHandler 50 | except ImportError: 51 | # compat for python 2.6 52 | from logging import Handler 53 | class NullHandler(Handler): 54 | def emit(self, record): 55 | pass 56 | log_scapy = logging.getLogger("scapy") 57 | log_scapy.addHandler(NullHandler()) 58 | log_runtime = logging.getLogger("scapy.runtime") # logs at runtime 59 | log_runtime.addFilter(ScapyFreqFilter()) 60 | log_interactive = logging.getLogger("scapy.interactive") # logs in interactive functions 61 | log_loading = logging.getLogger("scapy.loading") # logs when loading scapy 62 | 63 | 64 | def warning(x): 65 | log_runtime.warning(x) 66 | 67 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/__init__.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Layer package. 8 | """ 9 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/all.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | All layers. Configurable with conf.load_layers. 8 | """ 9 | 10 | from scapy.config import conf 11 | from scapy.error import log_loading 12 | import logging 13 | log = logging.getLogger("scapy.loading") 14 | 15 | __all__ = [] 16 | 17 | def _import_star(m): 18 | mod = __import__(m, globals(), locals()) 19 | if '__all__' in mod.__dict__: 20 | # only import the exported symbols in __all__ 21 | for name in mod.__dict__['__all__']: 22 | __all__.append(name) 23 | globals()[name] = mod.__dict__[name] 24 | else: 25 | # import all the non-private symbols 26 | for name, sym in mod.__dict__.iteritems(): 27 | if name[0] != '_': 28 | __all__.append(name) 29 | globals()[name] = sym 30 | 31 | for _l in conf.load_layers: 32 | log_loading.debug("Loading layer %s" % _l) 33 | try: 34 | _import_star(_l) 35 | except Exception,e: 36 | log.warning("can't import layer %s: %s" % (_l,e)) 37 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/clns.py: -------------------------------------------------------------------------------- 1 | """ 2 | CLNS Extension 3 | ~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | :copyright: 2014, 2015 BENOCS GmbH, Berlin (Germany) 6 | :author: Marcel Patzlaff, mpatzlaff@benocs.com 7 | :license: GPLv2 8 | 9 | This module is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License 11 | as published by the Free Software Foundation; either version 2 12 | of the License, or (at your option) any later version. 13 | 14 | This module is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | :description: 20 | 21 | This module provides a registration function and a generic PDU 22 | for OSI Connectionless-mode Network Services (such as IS-IS). 23 | """ 24 | import struct 25 | 26 | from scapy.config import conf 27 | from scapy.fields import ByteEnumField, PacketField 28 | from scapy.layers.l2 import LLC 29 | from scapy.packet import Packet, bind_top_down, bind_bottom_up 30 | 31 | 32 | network_layer_protocol_ids = { 33 | 0x00: "Null", 34 | 0x08: "Q.933", 35 | 0x80: "IEEE SNAP", 36 | 0x81: "ISO 8438 CLNP", 37 | 0x82: "ISO 9542 ES-IS", 38 | 0x83: "ISO 10589 IS-IS", 39 | 0x8E: "IPv6", 40 | 0xB0: "FRF.9", 41 | 0xB1: "FRF.12", 42 | 0xC0: "TRILL", 43 | 0xC1: "IEEE 802.aq", 44 | 0xCC: "IPv4", 45 | 0xCF: "PPP" 46 | } 47 | 48 | 49 | _cln_protocols = {} 50 | 51 | 52 | class _GenericClnsPdu(Packet): 53 | name = "Generic CLNS PDU" 54 | fields_desc = [ 55 | ByteEnumField("nlpid", 0x00, network_layer_protocol_ids), 56 | PacketField("rawdata", None, conf.raw_layer) 57 | ] 58 | 59 | 60 | def _create_cln_pdu(s, **kwargs): 61 | pdu_cls = conf.raw_layer 62 | 63 | if len(s) >= 1: 64 | nlpid = struct.unpack("!B", s[0])[0] 65 | pdu_cls = _cln_protocols.get(nlpid, _GenericClnsPdu) 66 | 67 | return pdu_cls(s, **kwargs) 68 | 69 | 70 | @conf.commands.register 71 | def register_cln_protocol(nlpid, cln_protocol_class): 72 | if nlpid is None or cln_protocol_class is None: 73 | return 74 | 75 | chk = _cln_protocols.get(nlpid, None) 76 | if chk is not None and chk != cln_protocol_class: 77 | raise ValueError("different protocol already registered!") 78 | 79 | _cln_protocols[nlpid] = cln_protocol_class 80 | bind_top_down(LLC, cln_protocol_class, dsap=0xfe, ssap=0xfe, ctrl=3) 81 | 82 | 83 | bind_top_down(LLC, _GenericClnsPdu, dsap=0xfe, ssap=0xfe, ctrl=3) 84 | bind_bottom_up(LLC, _create_cln_pdu, dsap=0xfe, ssap=0xfe, ctrl=3) 85 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/gprs.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | GPRS (General Packet Radio Service) for mobile data communication. 8 | """ 9 | 10 | from scapy.fields import * 11 | from scapy.packet import * 12 | from scapy.layers.inet import IP 13 | 14 | class GPRS(Packet): 15 | name = "GPRSdummy" 16 | fields_desc = [ 17 | StrStopField("dummy","","\x65\x00\x00",1) 18 | ] 19 | 20 | 21 | bind_layers( GPRS, IP, ) 22 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/ir.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | IrDA infrared data communication. 8 | """ 9 | 10 | from scapy.packet import * 11 | from scapy.fields import * 12 | from scapy.layers.l2 import CookedLinux 13 | 14 | 15 | 16 | # IR 17 | 18 | class IrLAPHead(Packet): 19 | name = "IrDA Link Access Protocol Header" 20 | fields_desc = [ XBitField("Address", 0x7f, 7), 21 | BitEnumField("Type", 1, 1, {"Response":0, 22 | "Command":1})] 23 | 24 | class IrLAPCommand(Packet): 25 | name = "IrDA Link Access Protocol Command" 26 | fields_desc = [ XByteField("Control", 0), 27 | XByteField("Format identifier", 0), 28 | XIntField("Source address", 0), 29 | XIntField("Destination address", 0xffffffffL), 30 | XByteField("Discovery flags", 0x1), 31 | ByteEnumField("Slot number", 255, {"final":255}), 32 | XByteField("Version", 0)] 33 | 34 | 35 | class IrLMP(Packet): 36 | name = "IrDA Link Management Protocol" 37 | fields_desc = [ XShortField("Service hints", 0), 38 | XByteField("Character set", 0), 39 | StrField("Device name", "") ] 40 | 41 | 42 | bind_layers( CookedLinux, IrLAPHead, proto=23) 43 | bind_layers( IrLAPHead, IrLAPCommand, Type=1) 44 | bind_layers( IrLAPCommand, IrLMP, ) 45 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/l2tp.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | L2TP (Layer 2 Tunneling Protocol) for VPNs. 8 | 9 | [RFC 2661] 10 | """ 11 | 12 | import struct 13 | 14 | from scapy.packet import * 15 | from scapy.fields import * 16 | from scapy.layers.inet import UDP 17 | from scapy.layers.ppp import PPP 18 | 19 | class L2TP(Packet): 20 | fields_desc = [ ShortEnumField("pkt_type",2,{2:"data"}), 21 | ShortField("len", None), 22 | ShortField("tunnel_id", 0), 23 | ShortField("session_id", 0), 24 | ShortField("ns", 0), 25 | ShortField("nr", 0), 26 | ShortField("offset", 0) ] 27 | 28 | def post_build(self, pkt, pay): 29 | if self.len is None: 30 | l = len(pkt)+len(pay) 31 | pkt = pkt[:2]+struct.pack("!H", l)+pkt[4:] 32 | return pkt+pay 33 | 34 | 35 | bind_layers( UDP, L2TP, sport=1701, dport=1701) 36 | bind_layers( L2TP, PPP, ) 37 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/llmnr.py: -------------------------------------------------------------------------------- 1 | from scapy.fields import * 2 | from scapy.packet import * 3 | from scapy.layers.inet import UDP 4 | from scapy.layers.dns import DNSQRField, DNSRRField, DNSRRCountField 5 | 6 | """ 7 | LLMNR (Link Local Multicast Node Resolution). 8 | 9 | [RFC 4795] 10 | """ 11 | 12 | ############################################################################# 13 | ### LLMNR (RFC4795) ### 14 | ############################################################################# 15 | # LLMNR is based on the DNS packet format (RFC1035 Section 4) 16 | # RFC also envisions LLMNR over TCP. Like vista, we don't support it -- arno 17 | 18 | _LLMNR_IPv6_mcast_Addr = "FF02:0:0:0:0:0:1:3" 19 | _LLMNR_IPv4_mcast_addr = "224.0.0.252" 20 | 21 | class LLMNRQuery(Packet): 22 | name = "Link Local Multicast Node Resolution - Query" 23 | fields_desc = [ ShortField("id", 0), 24 | BitField("qr", 0, 1), 25 | BitEnumField("opcode", 0, 4, { 0:"QUERY" }), 26 | BitField("c", 0, 1), 27 | BitField("tc", 0, 2), 28 | BitField("z", 0, 4), 29 | BitEnumField("rcode", 0, 4, { 0:"ok" }), 30 | DNSRRCountField("qdcount", None, "qd"), 31 | DNSRRCountField("ancount", None, "an"), 32 | DNSRRCountField("nscount", None, "ns"), 33 | DNSRRCountField("arcount", None, "ar"), 34 | DNSQRField("qd", "qdcount"), 35 | DNSRRField("an", "ancount"), 36 | DNSRRField("ns", "nscount"), 37 | DNSRRField("ar", "arcount",0)] 38 | overload_fields = {UDP: {"sport": 5355, "dport": 5355 }} 39 | def hashret(self): 40 | return struct.pack("!H", self.id) 41 | 42 | class LLMNRResponse(LLMNRQuery): 43 | name = "Link Local Multicast Node Resolution - Response" 44 | qr = 1 45 | def answers(self, other): 46 | return (isinstance(other, LLMNRQuery) and 47 | self.id == other.id and 48 | self.qr == 1 and 49 | other.qr == 0) 50 | 51 | def _llmnr_dispatcher(x, *args, **kargs): 52 | cls = conf.raw_layer 53 | if len(x) >= 3: 54 | if (ord(x[4]) & 0x80): # Response 55 | cls = LLMNRResponse 56 | else: # Query 57 | cls = LLMNRQuery 58 | return cls(x, *args, **kargs) 59 | 60 | bind_bottom_up(UDP, _llmnr_dispatcher, { "dport": 5355 }) 61 | bind_bottom_up(UDP, _llmnr_dispatcher, { "sport": 5355 }) 62 | 63 | # LLMNRQuery(id=RandShort(), qd=DNSQR(qname="vista."))) 64 | 65 | 66 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/mgcp.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | MGCP (Media Gateway Control Protocol) 8 | 9 | [RFC 2805] 10 | """ 11 | 12 | from scapy.packet import * 13 | from scapy.fields import * 14 | from scapy.layers.inet import UDP 15 | 16 | class MGCP(Packet): 17 | name = "MGCP" 18 | longname = "Media Gateway Control Protocol" 19 | fields_desc = [ StrStopField("verb","AUEP"," ", -1), 20 | StrFixedLenField("sep1"," ",1), 21 | StrStopField("transaction_id","1234567"," ", -1), 22 | StrFixedLenField("sep2"," ",1), 23 | StrStopField("endpoint","dummy@dummy.net"," ", -1), 24 | StrFixedLenField("sep3"," ",1), 25 | StrStopField("version","MGCP 1.0 NCS 1.0","\x0a", -1), 26 | StrFixedLenField("sep4","\x0a",1), 27 | ] 28 | 29 | 30 | #class MGCP(Packet): 31 | # name = "MGCP" 32 | # longname = "Media Gateway Control Protocol" 33 | # fields_desc = [ ByteEnumField("type",0, ["request","response","others"]), 34 | # ByteField("code0",0), 35 | # ByteField("code1",0), 36 | # ByteField("code2",0), 37 | # ByteField("code3",0), 38 | # ByteField("code4",0), 39 | # IntField("trasid",0), 40 | # IntField("req_time",0), 41 | # ByteField("is_duplicate",0), 42 | # ByteField("req_available",0) ] 43 | # 44 | bind_layers( UDP, MGCP, dport=2727) 45 | bind_layers( UDP, MGCP, sport=2727) 46 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/mobileip.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Mobile IP. 8 | """ 9 | 10 | from scapy.fields import * 11 | from scapy.packet import * 12 | from scapy.layers.inet import IP,UDP 13 | 14 | 15 | class MobileIP(Packet): 16 | name = "Mobile IP (RFC3344)" 17 | fields_desc = [ ByteEnumField("type", 1, {1:"RRQ", 3:"RRP"}) ] 18 | 19 | class MobileIPRRQ(Packet): 20 | name = "Mobile IP Registration Request (RFC3344)" 21 | fields_desc = [ XByteField("flags", 0), 22 | ShortField("lifetime", 180), 23 | IPField("homeaddr", "0.0.0.0"), 24 | IPField("haaddr", "0.0.0.0"), 25 | IPField("coaddr", "0.0.0.0"), 26 | LongField("id", 0), ] 27 | 28 | class MobileIPRRP(Packet): 29 | name = "Mobile IP Registration Reply (RFC3344)" 30 | fields_desc = [ ByteField("code", 0), 31 | ShortField("lifetime", 180), 32 | IPField("homeaddr", "0.0.0.0"), 33 | IPField("haaddr", "0.0.0.0"), 34 | LongField("id", 0), ] 35 | 36 | class MobileIPTunnelData(Packet): 37 | name = "Mobile IP Tunnel Data Message (RFC3519)" 38 | fields_desc = [ ByteField("nexthdr", 4), 39 | ShortField("res", 0) ] 40 | 41 | 42 | bind_layers( UDP, MobileIP, sport=434) 43 | bind_layers( UDP, MobileIP, dport=434) 44 | bind_layers( MobileIP, MobileIPRRQ, type=1) 45 | bind_layers( MobileIP, MobileIPRRP, type=3) 46 | bind_layers( MobileIP, MobileIPTunnelData, type=4) 47 | bind_layers( MobileIPTunnelData, IP, nexthdr=4) 48 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/rtp.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | RTP (Real-time Transport Protocol). 8 | """ 9 | 10 | from scapy.packet import * 11 | from scapy.fields import * 12 | 13 | _rtp_payload_types = { 14 | # http://www.iana.org/assignments/rtp-parameters 15 | 0: 'G.711 PCMU', 3: 'GSM', 16 | 4: 'G723', 5: 'DVI4', 17 | 6: 'DVI4', 7: 'LPC', 18 | 8: 'PCMA', 9: 'G722', 19 | 10: 'L16', 11: 'L16', 20 | 12: 'QCELP', 13: 'CN', 21 | 14: 'MPA', 15: 'G728', 22 | 16: 'DVI4', 17: 'DVI4', 23 | 18: 'G729', 25: 'CelB', 24 | 26: 'JPEG', 28: 'nv', 25 | 31: 'H261', 32: 'MPV', 26 | 33: 'MP2T', 34: 'H263' } 27 | 28 | class RTP(Packet): 29 | name="RTP" 30 | fields_desc = [ BitField('version', 2, 2), 31 | BitField('padding', 0, 1), 32 | BitField('extension', 0, 1), 33 | BitFieldLenField('numsync', None, 4, count_of='sync'), 34 | BitField('marker', 0, 1), 35 | BitEnumField('payload_type', 0, 7, _rtp_payload_types), 36 | ShortField('sequence', 0), 37 | IntField('timestamp', 0), 38 | IntField('sourcesync', 0), 39 | FieldListField('sync', [], IntField("id",0), count_from=lambda pkt:pkt.numsync) ] 40 | 41 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/tls/__init__.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Arnaud Ebalard, Maxence Tury 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Tools for handling TLS sessions and digital certificates. 8 | """ 9 | 10 | try: 11 | import Crypto 12 | except ImportError: 13 | import logging 14 | log_loading = logging.getLogger("scapy.loading") 15 | log_loading.info("Can't import python Crypto lib. Disabled certificate manipulation tools") 16 | 17 | try: 18 | import ecdsa 19 | except ImportError: 20 | import logging 21 | log_loading = logging.getLogger("scapy.loading") 22 | log_loading.info("Can't import python ecdsa lib. Disabled certificate manipulation tools") 23 | else: 24 | from scapy.layers.tls.cert import * 25 | -------------------------------------------------------------------------------- /executor/libs/scapy/layers/tls/crypto/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/executor/libs/scapy/layers/tls/crypto/__init__.py -------------------------------------------------------------------------------- /executor/libs/scapy/layers/vrrp.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## Copyright (C) 6WIND 5 | ## This program is published under a GPLv2 license 6 | 7 | """ 8 | VRRP (Virtual Router Redundancy Protocol). 9 | """ 10 | 11 | from scapy.packet import * 12 | from scapy.fields import * 13 | from scapy.layers.inet import IP 14 | 15 | IPPROTO_VRRP=112 16 | 17 | # RFC 3768 - Virtual Router Redundancy Protocol (VRRP) 18 | class VRRP(Packet): 19 | fields_desc = [ 20 | BitField("version" , 2, 4), 21 | BitField("type" , 1, 4), 22 | ByteField("vrid", 1), 23 | ByteField("priority", 100), 24 | FieldLenField("ipcount", None, count_of="addrlist", fmt="B"), 25 | ByteField("authtype", 0), 26 | ByteField("adv", 1), 27 | XShortField("chksum", None), 28 | FieldListField("addrlist", [], IPField("", "0.0.0.0"), 29 | count_from = lambda pkt: pkt.ipcount), 30 | IntField("auth1", 0), 31 | IntField("auth2", 0) ] 32 | 33 | def post_build(self, p, pay): 34 | if self.chksum is None: 35 | ck = checksum(p) 36 | p = p[:6]+chr(ck>>8)+chr(ck&0xff)+p[8:] 37 | return p 38 | 39 | bind_layers( IP, VRRP, proto=IPPROTO_VRRP) 40 | -------------------------------------------------------------------------------- /executor/libs/scapy/modules/__init__.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Package of extension modules that have to be loaded explicitly. 8 | """ 9 | -------------------------------------------------------------------------------- /executor/libs/scapy/tools/__init__.py: -------------------------------------------------------------------------------- 1 | ## This file is part of Scapy 2 | ## See http://www.secdev.org/projects/scapy for more informations 3 | ## Copyright (C) Philippe Biondi 4 | ## This program is published under a GPLv2 license 5 | 6 | """ 7 | Additional tools to be run separately 8 | """ 9 | -------------------------------------------------------------------------------- /executor/libs/spur/__init__.py: -------------------------------------------------------------------------------- 1 | from spur.local import LocalShell 2 | from spur.ssh import SshShell 3 | from spur.results import RunProcessError 4 | from spur.errors import NoSuchCommandError, CommandInitializationError 5 | 6 | __all__ = ["LocalShell", "SshShell", "RunProcessError", "NoSuchCommandError", 7 | "CommandInitializationError"] 8 | -------------------------------------------------------------------------------- /executor/libs/spur/errors.py: -------------------------------------------------------------------------------- 1 | class NoSuchCommandError(OSError): 2 | def __init__(self, command): 3 | if "/" in command: 4 | message = "No such command: {0}".format(command) 5 | else: 6 | message = "Command not found: {0}. Check that {0} is installed and on $PATH".format(command) 7 | super(type(self), self).__init__(message) 8 | self.command = command 9 | 10 | 11 | class CommandInitializationError(Exception): 12 | def __init__(self, line): 13 | super(type(self), self).__init__( 14 | """Error while initializing command. The most likely cause is an unsupported shell. Try using a minimal shell type when calling 'spawn' or 'run'. 15 | (Failed to parse line '{0}' as integer)""".format(line) 16 | ) 17 | -------------------------------------------------------------------------------- /executor/libs/spur/files.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | class FileOperations(object): 4 | def __init__(self, shell): 5 | self._shell = shell 6 | 7 | def copy_file(self, source, destination=None, dir=None): 8 | if destination is None and dir is None: 9 | raise TypeError("Destination required for copy") 10 | 11 | if destination is not None: 12 | self._shell.run(["cp", "-T", source, destination]) 13 | elif dir is not None: 14 | self._shell.run(["cp", source, "-t", dir]) 15 | 16 | def write_file(self, path, contents): 17 | self._shell.run(["mkdir", "-p", os.path.dirname(path)]) 18 | file = self._shell.open(path, "w") 19 | try: 20 | file.write(contents) 21 | finally: 22 | file.close() 23 | 24 | -------------------------------------------------------------------------------- /executor/libs/spur/io.py: -------------------------------------------------------------------------------- 1 | import threading 2 | 3 | 4 | class IoHandler(object): 5 | def __init__(self, in_out_pairs): 6 | self._handlers = [ 7 | OutputHandler(file_in, file_out) 8 | for file_in, file_out 9 | in in_out_pairs 10 | ] 11 | 12 | def wait(self): 13 | return [handler.wait() for handler in self._handlers] 14 | 15 | 16 | class OutputHandler(object): 17 | def __init__(self, file_in, file_out): 18 | self._file_in = file_in 19 | self._file_out = file_out 20 | self._output = "" 21 | 22 | self._thread = threading.Thread(target=self._capture_output) 23 | self._thread.daemon = True 24 | self._thread.start() 25 | 26 | def wait(self): 27 | self._thread.join() 28 | return self._output 29 | 30 | def _capture_output(self): 31 | if self._file_out is None: 32 | try: 33 | self._output = self._file_in.read() 34 | except IOError: 35 | # TODO: is there a more elegant fix? 36 | # Attempting to read from a pty master that has received nothing 37 | # seems to raise an IOError when reading 38 | # See: http://bugs.python.org/issue5380 39 | self._output = b"" 40 | else: 41 | output_buffer = [] 42 | while True: 43 | output = self._file_in.read(1) 44 | if output: 45 | self._file_out.write(output) 46 | output_buffer.append(output) 47 | else: 48 | self._output = b"".join(output_buffer) 49 | return 50 | -------------------------------------------------------------------------------- /executor/libs/spur/results.py: -------------------------------------------------------------------------------- 1 | import locale 2 | 3 | 4 | def result(return_code, allow_error, output, stderr_output): 5 | result = ExecutionResult(return_code, output, stderr_output) 6 | if return_code == 0 or allow_error: 7 | return result 8 | else: 9 | raise result.to_error() 10 | 11 | 12 | class ExecutionResult(object): 13 | def __init__(self, return_code, output, stderr_output): 14 | self.return_code = return_code 15 | self.output = output 16 | self.stderr_output = stderr_output 17 | 18 | def to_error(self): 19 | return RunProcessError( 20 | self.return_code, 21 | self.output, 22 | self.stderr_output 23 | ) 24 | 25 | 26 | class RunProcessError(RuntimeError): 27 | def __init__(self, return_code, output, stderr_output): 28 | message = "return code: {0}\noutput: {1}\nstderr output: {2}".format( 29 | return_code, _bytes_repr(output), _bytes_repr(stderr_output)) 30 | super(type(self), self).__init__(message) 31 | self.return_code = return_code 32 | self.output = output 33 | self.stderr_output = stderr_output 34 | 35 | 36 | def _bytes_repr(raw_bytes): 37 | result = repr(raw_bytes) 38 | if result.startswith("b"): 39 | return result 40 | else: 41 | return "b" + result 42 | -------------------------------------------------------------------------------- /executor/libs/spur/tempdir.py: -------------------------------------------------------------------------------- 1 | import contextlib 2 | import tempfile 3 | import shutil 4 | 5 | @contextlib.contextmanager 6 | def create_temporary_dir(): 7 | dir = tempfile.mkdtemp() 8 | try: 9 | yield dir 10 | finally: 11 | shutil.rmtree(dir) 12 | -------------------------------------------------------------------------------- /files/bigfile.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/files/bigfile.gz -------------------------------------------------------------------------------- /files/smallfile.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/files/smallfile.gz -------------------------------------------------------------------------------- /logs/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/logs/.placeholder -------------------------------------------------------------------------------- /monitor/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Author: Samuel Jero 3 | ############################################################################### 4 | CPP=g++ 5 | CC=gcc 6 | CPPFLAGS=-fPIC -pie -O2 -Wall -Werror -Wextra -g 7 | 8 | BINARIES=monitor 9 | MONITOR_HEADERS=monitor.h iface.h proto.h algorithm.h classic.h tcp.h 10 | MONITOR_SRC=monitor.cc tracker.cc iface.cc classic.cc tcp.cc 11 | 12 | 13 | .PHONY: clean 14 | 15 | all: $(BINARIES) 16 | 17 | clean: 18 | rm -f $(BINARIES) *.o *~ 19 | 20 | monitor: $(MONITOR_HEADERS) $(MONITOR_SRC) 21 | $(CPP) $(CPPFLAGS) $(MONITOR_SRC) -o monitor -lpthread -lrt 22 | 23 | -------------------------------------------------------------------------------- /monitor/algorithm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * Congestion Control Sender Monitor: General CC Algorithm 4 | ******************************************************************************/ 5 | #ifndef _ALGORITHM_H 6 | #define _ALGORITHM_H 7 | 8 | #include "monitor.h" 9 | 10 | class Algorithm { 11 | public: 12 | virtual ~Algorithm () {} 13 | virtual void new_packet(pkt_info pk, Message hdr) = 0; 14 | virtual bool stop() = 0; 15 | virtual bool start() = 0; 16 | virtual bool isRunning() = 0; 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /monitor/classic.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * Congestion Control Sender Monitor: Classic AIMD, loss-based CC algorithm 4 | ******************************************************************************/ 5 | #ifndef _CLASSIC_H 6 | #define _CLASSIC_H 7 | 8 | #include "algorithm.h" 9 | #include "proto.h" 10 | 11 | 12 | #define STATE_UNKNOWN 0 13 | #define STATE_INIT 1 14 | #define STATE_SLOW_START 2 15 | #define STATE_CONG_AVOID 3 16 | #define STATE_FAST_RECOV 4 17 | #define STATE_RTO 5 18 | #define STATE_END 6 19 | 20 | #define INT_TME 10 21 | #define INT_PKT 5 22 | #define INT_RTO 200 23 | #define MSEC2USEC 1000 24 | #define MSEC2NSEC 1000000 25 | 26 | class Classic: public Algorithm { 27 | public: 28 | Classic(Proto *p); 29 | ~Classic(); 30 | virtual void new_packet(pkt_info pk, Message hdr); 31 | virtual bool start(); 32 | virtual bool stop(); 33 | virtual bool isRunning() {return running || thread_running;} 34 | 35 | private: 36 | static void* thread_run(void* arg); 37 | void run(); 38 | void processClassicCongestionControl(); 39 | void printState(int oldstate, int state); 40 | char* timestamp(char* buff, int len); 41 | void triggerTimerNow(); 42 | 43 | pthread_t thread; 44 | bool running; 45 | bool thread_running; 46 | bool thread_cleanup; 47 | Proto *p; 48 | 49 | int state; 50 | int old_state; 51 | int idle_periods; 52 | bool urgent_event; 53 | double prior_ratio; 54 | struct timeval last_packet; 55 | struct timeval prior_packet; 56 | struct timeval last_idle; 57 | pthread_mutex_t time_lock; 58 | timer_t pkt_timr; 59 | timer_t int_timr; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /monitor/iface.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * TCP Congestion Control Proxy: Interface read/write thread 4 | ******************************************************************************/ 5 | #ifndef _IFACE_H 6 | #define _IFACE_H 7 | #include "monitor.h" 8 | #include 9 | 10 | class Iface{ 11 | public: 12 | Iface(); 13 | Iface(std::string interface); 14 | ~Iface(); 15 | bool sendm(Message m, bool allow_drop = false); 16 | bool start(); 17 | bool stop(); 18 | bool isRunning() {return running || rcv_thread_running;} 19 | void setDirection(enum direction dir) {this->dir = dir;} 20 | enum direction getDirection() {return dir;} 21 | void setOther(Iface *othr) { this->other = othr;} 22 | Iface* getOther() {return other;} 23 | 24 | private: 25 | static void* rcv_thread_run(void* arg); 26 | void rcv_run(); 27 | bool _stop(); 28 | Message recvMsg(); 29 | 30 | int sock; 31 | std::string iface; 32 | Iface* other; 33 | bool running; 34 | bool rcv_thread_running; 35 | bool rcv_thread_cleanup; 36 | bool print_messages; 37 | enum direction dir; 38 | pthread_t rcv_thread; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /monitor/monitor.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | ******************************************************************************/ 4 | #ifndef _MONITOR_H 5 | #define _MONITOR_H 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | class Message{ 23 | public: 24 | char *buff; 25 | int len; 26 | int alloc; 27 | }; 28 | 29 | enum direction { 30 | NONE = 0, 31 | FORWARD = 1, 32 | BACKWARD = 2 33 | }; 34 | 35 | class Iface; 36 | 37 | class pkt_info { 38 | public: 39 | bool valid; 40 | Message msg; 41 | enum direction dir; 42 | int ip_type; 43 | char *ip_src; 44 | char *ip_dst; 45 | char *mac_src; 46 | char *mac_dst; 47 | Iface *rcv; 48 | Iface *snd; 49 | }; 50 | 51 | /* Get interface commands */ 52 | Iface *GetForwardInterface(); 53 | Iface *GetBackwardInterface(); 54 | 55 | /*debug printf 56 | * Levels: 57 | * 0) Always print even if debug isn't specified 58 | * 1) Errors and warnings... Don't overload the screen with too much output 59 | * 2) Notes and per-packet processing info... as verbose as needed 60 | */ 61 | extern int monitor_debug; 62 | void dbgprintf(int level, const char *fmt, ...); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /monitor/proto.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * Congestion Control Sender Monitor: General Proto 4 | ******************************************************************************/ 5 | #ifndef _PROTO_H 6 | #define _PROTO_H 7 | 8 | #include "monitor.h" 9 | 10 | class Proto { 11 | public: 12 | virtual ~Proto() {} 13 | virtual bool new_packet(pkt_info pk, Message hdr) = 0; 14 | virtual bool hasIPProto(int num) = 0; 15 | virtual void lockCtrs() = 0; 16 | virtual void unlockCtrs() = 0; 17 | virtual const char* name() = 0; 18 | virtual unsigned long DataPkts() = 0; 19 | virtual unsigned long AckPkts() = 0; 20 | virtual unsigned long DataBytes() = 0; 21 | virtual unsigned long AckBytes() = 0; 22 | virtual unsigned long Retransmissions() = 0; 23 | virtual void setAckHolds() = 0; 24 | virtual bool AckHoldsNotPassed() = 0; 25 | virtual bool isStart() = 0; 26 | virtual bool isEnd() = 0; 27 | virtual bool isUnknown() = 0; 28 | virtual void resetCtrs() = 0; 29 | virtual const char* getIP1() = 0; 30 | virtual const char* getIP2() = 0; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /monitor/tcp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * Congestion Control Sender Monitor: TCP specific header 4 | ******************************************************************************/ 5 | #ifndef _TCP_H 6 | #define _TCP_H 7 | 8 | #include "proto.h" 9 | #include 10 | 11 | #define TCP_STATE_UNKNOWN 0 12 | #define TCP_STATE_START 1 13 | #define TCP_STATE_MID 2 14 | #define TCP_STATE_END 3 15 | 16 | class TCP: public Proto { 17 | public: 18 | TCP(); 19 | ~TCP(); 20 | virtual bool new_packet(pkt_info pk, Message hdr); 21 | virtual bool hasIPProto(int num) {return num == 6;} 22 | virtual const char* name() {return "TCP";} 23 | virtual void lockCtrs() {pthread_rwlock_wrlock(&lock);} 24 | virtual void unlockCtrs() {pthread_rwlock_unlock(&lock);} 25 | virtual unsigned long DataPkts() {return tcp_data_pkts;} 26 | virtual unsigned long AckPkts() {return tcp_ack_pkts;} 27 | virtual unsigned long DataBytes() {return tcp_data_bytes;} 28 | virtual unsigned long AckBytes() {return tcp_ack_bytes;} 29 | virtual unsigned long Retransmissions() {return tcp_retransmits;} 30 | virtual void setAckHolds(); 31 | virtual bool AckHoldsNotPassed(); 32 | virtual bool isStart() {return state == TCP_STATE_START;} 33 | virtual bool isEnd() {return state == TCP_STATE_END;} 34 | virtual bool isUnknown() {return state == TCP_STATE_UNKNOWN;} 35 | virtual void resetCtrs(); 36 | virtual const char* getIP1() {return ip1str;} 37 | virtual const char* getIP2() {return ip2str;} 38 | 39 | 40 | private: 41 | void updateTCPVars(Message hdr); 42 | void resolveIP2str(uint32_t ip, char* str, int len); 43 | 44 | pthread_rwlock_t lock; 45 | 46 | unsigned int tcp1_port; 47 | unsigned int tcp1_seq_low; 48 | unsigned int tcp1_seq_high; 49 | unsigned int tcp1_ack_low; 50 | unsigned int tcp1_ack_high; 51 | unsigned int tcp1_ack_hold; 52 | unsigned int tcp2_port; 53 | unsigned int tcp2_seq_low; 54 | unsigned int tcp2_seq_high; 55 | unsigned int tcp2_ack_low; 56 | unsigned int tcp2_ack_high; 57 | unsigned int tcp2_ack_hold; 58 | 59 | unsigned int tcp_data_pkts; 60 | unsigned int tcp_data_bytes; 61 | unsigned int tcp_ack_pkts; 62 | unsigned int tcp_ack_bytes; 63 | unsigned int tcp_ack_dup; 64 | unsigned int tcp_retransmits; 65 | int state; 66 | int old_state; 67 | int idle_periods; 68 | uint32_t ip1; 69 | uint32_t ip2; 70 | char ip1str[INET_ADDRSTRLEN]; 71 | char ip2str[INET_ADDRSTRLEN]; 72 | }; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /monitor/tracker.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * Congestion Control Sender State Tracker: Tracker Header 4 | ******************************************************************************/ 5 | #ifndef _TRACKER_H 6 | #define _TRACKER_H 7 | #include "monitor.h" 8 | #include "proto.h" 9 | #include "algorithm.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #define PROTO_ID_ERR (-1) 17 | #define PROTO_ID_MIN 0 18 | #define PROTO_ID_TCP 0 19 | #define PROTO_ID_MAX 0 20 | 21 | #define ALG_ID_ERR (-1) 22 | #define ALG_ID_MIN 0 23 | #define ALG_ID_CLASSIC 0 24 | #define ALG_ID_MAX 0 25 | 26 | class Tracker{ 27 | private: 28 | Tracker(); 29 | 30 | public: 31 | ~Tracker(); 32 | static Tracker& get(); 33 | pkt_info track(pkt_info pk); 34 | bool start(); 35 | bool stop(); 36 | bool isRunning() {return alg && alg->isRunning();} 37 | bool openOutputSocket(struct sockaddr_in &addr); 38 | bool closeOutputSocket(); 39 | bool setAlgorithmAndProtocol(char *alg, char* proto); 40 | void sendState(const char *state, const char* ip1, const char* ip2, const char* proto); 41 | 42 | private: 43 | void parseEthernet(pkt_info pk, Message cur); 44 | void parseIPv4(pkt_info pk, Message cur); 45 | int normalize_proto(char *s); 46 | int normalize_algorithm(char *s); 47 | int is_int(char *v); 48 | void print(pkt_info pk); 49 | bool sendMsg(Message m); 50 | void readAndThrowAway(); 51 | 52 | Proto* proto; 53 | Algorithm* alg; 54 | int alg_id; 55 | int proto_id; 56 | pthread_mutex_t lock; 57 | struct sockaddr_in output_addr; 58 | int sock; 59 | }; 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /proxy/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Author: Samuel Jero 3 | ############################################################################### 4 | CPP=g++ 5 | CC=gcc 6 | CPPFLAGS= -fPIC -pie -O2 -Wall -Werror -Wextra -Wpedantic -g 7 | 8 | BINARIES=proxy sndcmd 9 | PROXY_HEADERS=proxy.h control.h csv.h args.h iface.h checksums.h 10 | PROXY_SRC=proxy.cc control.cc args.cc csv.cc attacker.cc iface.cc checksums.c tcp.cc tcpModifiers.cc 11 | SNDCMD_SRC=sndcmd.cc 12 | 13 | 14 | .PHONY: clean 15 | 16 | all: $(BINARIES) 17 | 18 | clean: 19 | rm -f $(BINARIES) *.o *~ 20 | 21 | proxy: $(PROXY_HEADERS) $(PROXY_SRC) 22 | $(CPP) $(CPPFLAGS) $(PROXY_SRC) -o proxy -lpthread -Wl,-rpath,`pwd` -L`pwd` 23 | 24 | sndcmd: $(SNDCMD_SRC) 25 | $(CPP) $(CPPFLAGS) $(SNDCMD_SRC) -lpthread -o sndcmd 26 | 27 | -------------------------------------------------------------------------------- /proxy/args.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * args.h 3 | * A singly linked list to store argument key-value pairs. 4 | * Note that it does not duplicate the name string or value string. 5 | * Author Xiangyu Bu 6 | ******************************************************************************/ 7 | 8 | #ifndef _ARGS_H 9 | 10 | #define _ARGS_H 11 | 12 | /** 13 | * Argument value data type. 14 | */ 15 | typedef struct { 16 | int i; 17 | float f; 18 | char *s; 19 | } arg_value_t; 20 | 21 | #define ARG_VALUE_TYPE_NOVAL 0 22 | #define ARG_VALUE_TYPE_INT 1 23 | #define ARG_VALUE_TYPE_FLOAT 2 24 | #define ARG_VALUE_TYPE_STR 3 25 | 26 | typedef int arg_value_type_t; 27 | 28 | /** 29 | * Argument node data type. 30 | */ 31 | typedef struct arg_node { 32 | char *name; 33 | arg_value_type_t type; 34 | arg_value_t value; 35 | struct arg_node *next; 36 | } arg_node_t; 37 | 38 | /** 39 | * Determine if the C string represents an integer. 40 | */ 41 | int is_int(const char *); 42 | 43 | /** 44 | * Return -1 if the string is not a number. 0 if int. 1 if float. 45 | */ 46 | int is_float(char *); 47 | 48 | /** 49 | * Parse the C string into a list of arg_node_t values. The delimiter 50 | * is not escapable at this stage. 51 | * @param char *str The C string to parse. For example, "p=0.5&t=3". 52 | * @param char delim The delimiter of arguments. 53 | */ 54 | arg_node_t *args_parse(char *str, char delim); 55 | 56 | /** 57 | * Find argument node of given name. Return NULL if not found. 58 | */ 59 | arg_node_t *args_find(arg_node_t *head, const char *name); 60 | 61 | /** 62 | * Free the argument list. 63 | */ 64 | void args_free(arg_node_t *); 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /proxy/attacker.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * TCP Congestion Control Proxy: Malicious Processing 4 | ******************************************************************************/ 5 | #ifndef _ATTACKER_H 6 | #define _ATTACKER_H 7 | #include "proxy.h" 8 | #include "args.h" 9 | #include "proto.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #define ACTION_ID_ERR (-1) 17 | #define ACTION_ID_MIN 0 18 | #define ACTION_ID_ACTIVE 0 19 | #define ACTION_ID_TIME 1 20 | #define ACTION_ID_STATE 2 21 | #define ACTION_ID_INJECT 3 22 | #define ACTION_ID_DIV 4 23 | #define ACTION_ID_DUP 5 24 | #define ACTION_ID_PREACK 6 25 | #define ACTION_ID_RENEGE 7 26 | #define ACTION_ID_BURST 8 27 | #define ACTION_ID_FORCEACK 9 28 | #define ACTION_ID_LIMITACK 10 29 | #define ACTION_ID_DROP 11 30 | #define ACTION_ID_PRINT 12 31 | #define ACTION_ID_CLEAR 13 32 | #define ACTION_ID_MAX 13 33 | 34 | #define PROTO_ID_ERR (-1) 35 | #define PROTO_ID_MIN 0 36 | #define PROTO_ID_TCP 0 37 | #define PROTO_ID_MAX 0 38 | 39 | #define METHOD_ID_ERR (-1) 40 | #define METHOD_ID_MIN 0 41 | #define METHOD_ID_ABS 0 42 | #define METHOD_ID_REL_ALL 1 43 | #define METHOD_ID_REL_ONCE 2 44 | #define METHOD_ID_REL_INC 3 45 | #define METHOD_ID_MAX 3 46 | 47 | 48 | class Attacker{ 49 | private: 50 | Attacker(); 51 | 52 | public: 53 | ~Attacker(); 54 | static Attacker& get(); 55 | bool addCommand(Message m, Message *resp); 56 | pkt_info doAttack(pkt_info pk); 57 | pkt_info fixupAndSend(pkt_info pk, Message ip_payload, bool dosend); 58 | uint32_t normalize_addr(char* s); 59 | bool normalize_mac(char* str, char* raw); 60 | bool start(); 61 | bool stop(); 62 | 63 | private: 64 | pkt_info parseEthernet(pkt_info pk, Message cur); 65 | Message fixupEthernet(Message cur, Message ip_payload); 66 | pkt_info parseIPv4(pkt_info pk, Message cur); 67 | Message fixupIPv4(Message cur, Message ip_payload); 68 | pkt_info check_connection(pkt_info pk, Message cur); 69 | int normalize_action_type(char *s); 70 | int normalize_proto(char *s); 71 | unsigned long normalize_time(char *s); 72 | int normalize_from(char *s); 73 | int normalize_method(char *s); 74 | Proto* find_or_create_proto(uint32_t src, uint32_t dst, int proto); 75 | Proto* find_proto(uint32_t src, uint32_t dst); 76 | Proto* create_proto(uint32_t src, uint32_t dst, int proto); 77 | bool clear_connections(); 78 | void last_packet(Message *res); 79 | void get_conn_duration(Proto *obj, Message *res); 80 | 81 | void print(pkt_info pk); 82 | 83 | //src,dest,object 84 | std::map > connections; 85 | int ipv4_id; 86 | pthread_rwlock_t lock; 87 | 88 | timeval last_pkt; 89 | pthread_mutex_t time_lock; 90 | }; 91 | 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /proxy/checksums.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * IPv4 and IPv6 Header Checksum Code 3 | * 4 | * Copyright (C) 2013 Samuel Jero 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * Author: Samuel Jero 20 | * Date: 02/2013 21 | * ******************************************************************************/ 22 | #ifndef CHECKUMS_H 23 | #define CHECKSUMS_H 24 | 25 | #include 26 | #include 27 | 28 | #define IP4_ADDR_LEN 4 29 | #define IP6_ADDR_LEN 16 30 | 31 | u_int16_t ipv6_pseudohdr_chksum(u_char* buff, int len, u_char* dest, u_char* src, int type); 32 | u_int16_t ipv4_pseudohdr_chksum(u_char* buff, int len, u_char* dest, u_char* src, int type); 33 | u_int16_t ipv4_chksum(u_char* buff, int len); 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /proxy/control.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * TCP Congestion Control Proxy: Control Connection Support 4 | ******************************************************************************/ 5 | #ifndef _CONTROL_H 6 | #define _CONTROL_H 7 | #include "proxy.h" 8 | using namespace std; 9 | 10 | class Control { 11 | public: 12 | Control(int sock); 13 | ~Control(){} 14 | bool start(); 15 | bool isRunning() {return running;} 16 | 17 | private: 18 | static void* thread_run(void* arg); 19 | void run(); 20 | Message recvMsg(); 21 | bool sendMsg(Message m); 22 | 23 | int sock; 24 | bool running; 25 | pthread_t ctl_thread; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /proxy/csv.cc: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * csv.cc 3 | * A simple CSV parser. 4 | * Author Xiangyu Bu 5 | ******************************************************************************/ 6 | #include 7 | #include "csv.h" 8 | 9 | #define is_whitespace(c) (c == '\t' || c == ' ') 10 | #define is_newline(c) (c == '\n' || c == '\r') 11 | 12 | char *csv_find_next_comma(char *data, size_t maxlen, char quote) { 13 | char *back; 14 | while (maxlen > 0) { 15 | if (quote == '\0' && *data == ',') { 16 | *data = '\0'; 17 | // remove the whitespaces at the tail 18 | back = data - 1; 19 | while (is_whitespace(*back)) { 20 | *back = '\0'; 21 | --back; 22 | } 23 | return data; 24 | } else if (quote != '\0' && *data == quote && *(data - 1) != '\\') { 25 | // not an escaped quote, close the quote matching 26 | quote = '\0'; 27 | *data = '\0'; 28 | } 29 | ++data, --maxlen; 30 | } 31 | return NULL; 32 | } 33 | 34 | char **csv_parse(char *data, size_t len, size_t *num_fields) { 35 | size_t used = 0, cap = 5; 36 | char quote; 37 | char *next_delim; 38 | char **ret; 39 | 40 | // allocate memory that stores pointer list 41 | if (!(ret = (char **)malloc(cap * sizeof(char *)))) { 42 | perror("malloc"); 43 | return NULL; 44 | } 45 | 46 | while (len > 0) { 47 | // skip beginning whitespaces 48 | //fprintf(stderr, "len=%lu\n%s\n", len, data); 49 | 50 | while (is_whitespace(*data) && len > 0) ++data, --len; 51 | if (len == 0) { 52 | *data = '\0'; 53 | break; 54 | } 55 | 56 | if (*data == '"' || *data == '\'') quote = *data++; 57 | else quote = '\0'; 58 | 59 | if (used == cap) { 60 | // expand pointer array assuming no error 61 | ret = (char **)realloc(ret, cap * 2 * sizeof(char *)); 62 | cap = cap * 2; 63 | } 64 | ret[used++] = data; 65 | 66 | next_delim = csv_find_next_comma(data, len, quote); 67 | if (next_delim != NULL) { 68 | len -= next_delim - data + 1; 69 | data = next_delim + 1; 70 | } else { 71 | // any malformed data will be ignored 72 | break; 73 | } 74 | } 75 | 76 | *num_fields = used; 77 | return ret; 78 | } 79 | 80 | void csv_unescape(char *data) { 81 | // does NOT transform '\n' to newline char yet. 82 | while (*data != '\0') { 83 | if (*data == '\\') { 84 | *data = *(data + 1); 85 | ++data; 86 | } 87 | ++data; 88 | } 89 | } 90 | 91 | -------------------------------------------------------------------------------- /proxy/csv.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * csv.h 3 | * A tiny CSV parser. 4 | * Author Xiangyu Bu 5 | ******************************************************************************/ 6 | #ifndef _CSV_H 7 | 8 | #define _CSV_H 9 | 10 | #include 11 | 12 | /** 13 | * Given a row of CSV string, return a C string pointer array 14 | * and write the number of pointers to num_fields. 15 | * The pointer data must point to a writable memory area. 16 | */ 17 | char **csv_parse(char *data, size_t len, size_t *num_fields); 18 | 19 | /** 20 | * Unescape the C string. For example 'hello \"world\"' to 'hello "world"'. 21 | */ 22 | void csv_unescape(char *data); 23 | 24 | #define csv_free(x) free(x) 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /proxy/iface.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * TCP Congestion Control Proxy: Interface read/write thread 4 | ******************************************************************************/ 5 | #ifndef _IFACE_H 6 | #define _IFACE_H 7 | #include "proxy.h" 8 | #include 9 | 10 | class Iface{ 11 | public: 12 | Iface(); 13 | Iface(std::string interface); 14 | ~Iface(); 15 | bool sendm(Message m, bool allow_drop = false); 16 | bool start(); 17 | bool stop(); 18 | bool isRunning() {return running || rcv_thread_running;} 19 | void setDirection(enum direction dir) {this->dir = dir;} 20 | enum direction getDirection() {return dir;} 21 | void setOther(Iface *othr) { this->other = othr;} 22 | Iface* getOther() {return other;} 23 | 24 | private: 25 | static void* rcv_thread_run(void* arg); 26 | void rcv_run(); 27 | bool _stop(); 28 | Message recvMsg(); 29 | 30 | int sock; 31 | std::string iface; 32 | Iface* other; 33 | bool running; 34 | bool rcv_thread_running; 35 | bool rcv_thread_cleanup; 36 | bool print_messages; 37 | enum direction dir; 38 | pthread_t rcv_thread; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /proxy/limit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | iface1=eth1 4 | iface2=eth2 5 | speed=100Mbit #Most Systems 6 | queue=500 #Most Systems 7 | #speed=10Mbit #Windows 95 8 | #queue=50 #Windows95 9 | 10 | ifconfig $iface1 txqueuelen $queue 11 | ifconfig $iface2 txqueuelen $queue 12 | 13 | tc qdisc del root dev $iface1 14 | tc qdisc del root dev $iface2 15 | 16 | tc qdisc add dev $iface1 root handle 1:0 netem limit $queue rate $speed delay 10ms 17 | tc qdisc add dev $iface2 root handle 1:0 netem limit $queue rate $speed delay 10ms 18 | 19 | tc qdisc ls dev $iface1 20 | tc qdisc ls dev $iface2 21 | -------------------------------------------------------------------------------- /proxy/proto.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * TCP Congestion Control Proxy: General Attack code 4 | ******************************************************************************/ 5 | #ifndef _PROTO_H 6 | #define _PROTO_H 7 | 8 | #include "proxy.h" 9 | 10 | #define MAC_MAX 20 11 | #define IP_MAX 50 12 | 13 | class inject_info { 14 | public: 15 | char mac_src[MAC_MAX]; 16 | char mac_dst[MAC_MAX]; 17 | char ip_src[IP_MAX]; 18 | char ip_dst[IP_MAX]; 19 | int port_src; 20 | int port_dst; 21 | int type; 22 | int window; 23 | unsigned long seq; 24 | unsigned long ack; 25 | int freq; 26 | int num; 27 | int data; 28 | int method; 29 | int dir; 30 | unsigned long start; 31 | unsigned long stop; 32 | int state; 33 | }; 34 | 35 | class Proto { 36 | public: 37 | virtual ~Proto() {} 38 | virtual pkt_info new_packet(pkt_info pk, Message hdr) = 0; 39 | virtual bool validState(const char* state) = 0; 40 | virtual bool SetState(const char* state) = 0; 41 | virtual bool SetInject(unsigned long start, unsigned long stop, const char* state, inject_info &info) = 0; 42 | virtual bool SetDivision(unsigned long start, unsigned long stop, const char* state, int bytes_per_chunk) = 0; 43 | virtual bool SetDup(unsigned long start, unsigned long stop, const char* state, int num) = 0; 44 | virtual bool SetPreAck(unsigned long start, unsigned long stop, const char* state, int amt, int method) = 0; 45 | virtual bool SetRenege(unsigned long start, unsigned long stop, const char* state, int amt, int growth) = 0; 46 | virtual bool SetBurst(unsigned long start, unsigned long stop, const char* state, int num) = 0; 47 | virtual bool SetForceAck(unsigned long start, unsigned long stop, const char* state, int dir, int amt) = 0; 48 | virtual bool SetLimitAck(unsigned long start, unsigned long stop, const char* state) = 0; 49 | virtual bool SetDrop(unsigned long start, unsigned long stop, const char* state, int p) = 0; 50 | virtual bool Clear() = 0; 51 | virtual bool SetPrint(bool on) = 0; 52 | virtual bool GetDuration(timeval *tm) = 0; 53 | virtual bool GetBytes(unsigned long *bytes) = 0; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /proxy/proxy.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Author: Samuel Jero 3 | * TCP Congestion Control Proxy: Global Header 4 | ******************************************************************************/ 5 | #ifndef _SW_PROXY_H 6 | #define _SW_PROXY_H 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | class Message{ 23 | public: 24 | char *buff; 25 | int len; 26 | int alloc; 27 | }; 28 | 29 | enum direction { 30 | NONE = 0, 31 | FORWARD = 1, 32 | BACKWARD = 2 33 | }; 34 | 35 | class Iface; 36 | 37 | class pkt_info { 38 | public: 39 | bool valid; 40 | Message msg; 41 | enum direction dir; 42 | int ip_type; 43 | timeval time; 44 | char *ip_src; 45 | char *ip_dst; 46 | char *mac_src; 47 | char *mac_dst; 48 | Iface *rcv; 49 | Iface *snd; 50 | }; 51 | 52 | /* Get interface commands */ 53 | Iface *GetForwardInterface(); 54 | Iface *GetBackwardInterface(); 55 | 56 | /*debug printf 57 | * Levels: 58 | * 0) Always print even if debug isn't specified 59 | * 1) Errors and warnings... Don't overload the screen with too much output 60 | * 2) Notes and per-packet processing info... as verbose as needed 61 | */ 62 | extern int proxy_debug; 63 | void dbgprintf(int level, const char *fmt, ...); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /state_searcher/Makefile: -------------------------------------------------------------------------------- 1 | #======================================= 2 | # Build the project 3 | #=================================== 4 | 5 | BINDIR := bin 6 | TOOLDIR := tool 7 | CC := gcc 8 | CXX := g++ 9 | 10 | #==================================== 11 | 12 | all: prep build 13 | 14 | prep: 15 | mkdir -p $(BINDIR) 16 | 17 | build: 18 | make -C $(TOOLDIR)/ BINDIR=../$(BINDIR) 19 | 20 | 21 | clean: 22 | rm -rf $(BINDIR)/ 23 | make -C $(TOOLDIR) clean 24 | -------------------------------------------------------------------------------- /state_searcher/include/config.h: -------------------------------------------------------------------------------- 1 | //== config.h -----------------------------------------==// 2 | // 3 | // Created on: Apr 27, 2016 4 | // Author: Endadul Hoque (mhoque@purdue.edu) 5 | //==-------------------------------------------------------==// 6 | 7 | #ifndef INCLUDE_CONFIG_H_ 8 | #define INCLUDE_CONFIG_H_ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | /// Print functions 16 | #ifdef ENABLE_DEBUG 17 | #define PRINT_LOG(msg) do{ \ 18 | std::cerr << "Debug: " << msg << "\n"; \ 19 | } while(0) 20 | #else 21 | #define PRINT_LOG(msg) (void)0 22 | #endif 23 | 24 | #define FATAL_ERROR(msg) do{ \ 25 | std::cerr << "Error: " << msg << "\n"; \ 26 | exit(1); \ 27 | } while(0) 28 | 29 | 30 | #define FANCY_ASSERT(msg, cond) do{ \ 31 | if(!(cond)){\ 32 | std::stringstream ss; \ 33 | ss << msg; \ 34 | assert((cond) && ss.str().c_str()); \ 35 | }\ 36 | } while(0) 37 | 38 | 39 | 40 | #endif /* INCLUDE_CONFIG_H_ */ 41 | -------------------------------------------------------------------------------- /state_searcher/include/searcher.h: -------------------------------------------------------------------------------- 1 | //== core.h -----------------------------------------==// 2 | // 3 | // Created on: Apr 27, 2016 4 | // Author: Endadul Hoque (mhoque@purdue.edu) 5 | //==-------------------------------------------------------==// 6 | 7 | #ifndef INCLUDE_SEARCHER_H_ 8 | #define INCLUDE_SEARCHER_H_ 9 | 10 | #include "graph.h" 11 | 12 | typedef std::vector< std::pair > Path; 13 | 14 | class Searcher { 15 | private: 16 | std::vector output_paths; 17 | Graph *graph; 18 | 19 | // Check if the action exists on the path 20 | bool existsAction(Path &p, Action &a); 21 | 22 | // It updates the member `paths` 23 | void scanForSinglePath(Node *u, Path &p, Action &a); 24 | 25 | public: 26 | Searcher(Graph *g); 27 | ~Searcher(){} 28 | 29 | bool findPaths(Action a); 30 | 31 | void printPaths(); 32 | void printPaths(std::ostream &os); 33 | void printAbstractTestCases(std::string prefix); 34 | 35 | std::string toString(Path &p); 36 | std::string toStringPathConditions(Path &p); 37 | }; 38 | 39 | extern int debug; 40 | 41 | 42 | #endif /* INCLUDE_SEARCHER_H_ */ 43 | -------------------------------------------------------------------------------- /state_searcher/tool/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CXX = g++ 3 | INCLUDES = -I../include -I. 4 | CFLAGS = -fPIC -pie -O2 -g -Wall -Werror 5 | 6 | TARGET = searcher 7 | SRCS = ../lib/graph.cpp ../lib/searcher.cpp main.cpp 8 | 9 | ifndef BINDIR 10 | BINDIR := bin 11 | endif 12 | #============================================= 13 | 14 | all: $(TARGET) 15 | 16 | $(BINDIR): 17 | mkdir -p $@ 18 | 19 | 20 | $(TARGET): $(BINDIR) 21 | $(CXX) $(CFLAGS) $(INCLUDES) $(SRCS) -o $(BINDIR)/$@ 22 | 23 | clean: 24 | rm -rf $(BINDIR) 25 | 26 | -------------------------------------------------------------------------------- /utils/formatter.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | # Samuel Jero 4 | # Quick Results viewer 5 | import sys 6 | import os 7 | import re 8 | import argparse 9 | import pprint 10 | 11 | 12 | def main(args): 13 | pp = pprint.PrettyPrinter() 14 | 15 | #Parse Args 16 | argp = argparse.ArgumentParser(description='Formatted viewer') 17 | argp.add_argument('out_file', help="Output File") 18 | args = vars(argp.parse_args(args[1:])) 19 | 20 | #Open Results file 21 | resultfile = None 22 | try: 23 | resultfile = open(args['out_file'], "r") 24 | except Exception as e: 25 | print "Error: could not open %s" % (args['out_file']) 26 | sys.exit(1) 27 | 28 | for line in resultfile: 29 | line = line.strip() 30 | if line[0] == "#": 31 | print line 32 | continue 33 | 34 | result = None 35 | try: 36 | result = eval(line) 37 | except Exception as e: 38 | print e 39 | continue 40 | 41 | print pp.pformat(result) 42 | print "" 43 | 44 | 45 | return 0 46 | 47 | 48 | if __name__ == "__main__": 49 | main(sys.argv) 50 | -------------------------------------------------------------------------------- /utils/qv.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | # Samuel Jero 4 | # Quick Results viewer 5 | import sys 6 | import os 7 | import re 8 | import argparse 9 | import pprint 10 | 11 | 12 | def main(args): 13 | pp = pprint.PrettyPrinter() 14 | 15 | #Parse Args 16 | argp = argparse.ArgumentParser(description='Quick Results Viewer') 17 | argp.add_argument('out_file', help="Output File") 18 | args = vars(argp.parse_args(args[1:])) 19 | 20 | #Open Results file 21 | resultfile = None 22 | try: 23 | resultfile = open(args['out_file'], "r") 24 | except Exception as e: 25 | print "Error: could not open %s" % (args['out_file']) 26 | sys.exit(1) 27 | 28 | for line in resultfile: 29 | line = line.strip() 30 | if line[0] == "#": 31 | print line 32 | continue 33 | 34 | result = None 35 | try: 36 | result = eval(line) 37 | except Exception as e: 38 | print e 39 | continue 40 | 41 | if type(result) is not dict: 42 | print result 43 | 44 | strat = "" 45 | timestamp = "" 46 | testresult = "" 47 | byte = "" 48 | time = "" 49 | typ = "" 50 | 51 | if 'strat' in result: 52 | rawstrat = result['strat'] 53 | if 'strat' in rawstrat: 54 | strat = rawstrat['strat'] 55 | else: 56 | strat = rawstrat 57 | if 'type' in rawstrat: 58 | typ = rawstrat['type'] 59 | if 'date' in result: 60 | timestamp = result['date'] 61 | if 'reason' in result: 62 | testresult = result['reason'] 63 | if 'bytes' in result: 64 | byte = result['bytes'] 65 | if 'time' in result: 66 | time = result['time'] 67 | 68 | 69 | lst = [timestamp,testresult,typ,strat,time,byte] 70 | print pp.pformat(lst) 71 | 72 | 73 | return 0 74 | 75 | 76 | if __name__ == "__main__": 77 | main(sys.argv) 78 | -------------------------------------------------------------------------------- /utils/timingGraph.gnu: -------------------------------------------------------------------------------- 1 | # Author: Samuel Jero 2 | reset 3 | 4 | P=1 5 | EPS="TimingGraph.svg" 6 | 7 | if ( P == 1 ) { 8 | set term svg size 10000,2048 dynamic enhanced 9 | set object 1 rect from screen 0, 0, 0 to screen 1, 1, 0 behind 10 | set object 1 rect fc rgb "white" fillstyle solid 1.0 11 | #set term postscript eps enhanced color 12 size 12in, 2in 12 | } 13 | unset log 14 | unset label 15 | set datafile commentschars "#" 16 | 17 | if (P == 1) { 18 | set output EPS 19 | } 20 | set autoscale 21 | set grid noxtics ytics 22 | set key top left 23 | set title "Time to Completion for our Tests" 24 | set xlabel "Test" 25 | set ylabel "Time to Complete Test (download 100MB) in seconds" 26 | set boxwidth 0.9 absolute 27 | set style fill solid 1.00 border -1 28 | set style data histograms 29 | unset key 30 | set xtics out rotate by -60 31 | #unset xtics 32 | set yrange [0:] 33 | set xrange [0:] 34 | set style line 2 lw 4 lc rgb "blue" 35 | set style line 3 lw 4 lc rgb "orange" 36 | plot "./data.txt" using 2:xticlabels(1) ti col, 16.15 title "" with lines ls 2, 17.73 title "" with lines ls 2, \ 37 | "./data.txt" using (100-($3/(1024*1024))):xticlabels(1) ti col, (100*0.2) with lines ls 3 38 | #Wait until user hits enter to exit 39 | if (P == 0) { 40 | pause -1 41 | } 42 | -------------------------------------------------------------------------------- /vms/placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueljero/TCPwn/8514a9fa53123e4abe45460d008de2f5d91500f8/vms/placeholder --------------------------------------------------------------------------------