├── packet_queue ├── __init__.py ├── monitoring.py ├── interactive.py ├── command.py ├── web │ ├── index.html │ ├── packet_queue.js │ └── smoothie.js ├── nfqueue.py ├── libnetfilter_queue.py ├── simulation.py ├── udp_proxy.py └── api_server.py ├── setup.cfg ├── .gitignore ├── screenshot.png ├── scripts ├── impaired_network_shell ├── impaired_network_clear_iptables └── impaired_network_server ├── setup.py ├── Dockerfile ├── CONTRIBUTING.md ├── README.md ├── tests ├── test_simulation.py ├── test_e2e.py └── test_api_server.py └── LICENSE /packet_queue/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | build 4 | dist 5 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/packet-queue/HEAD/screenshot.png -------------------------------------------------------------------------------- /scripts/impaired_network_shell: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2016 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | from packet_queue import interactive 18 | 19 | interactive.main() 20 | -------------------------------------------------------------------------------- /scripts/impaired_network_clear_iptables: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2016 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | from packet_queue import nfqueue 18 | 19 | nfqueue.remove_all() 20 | -------------------------------------------------------------------------------- /scripts/impaired_network_server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2016 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | from twisted.internet import reactor 18 | from packet_queue import api_server 19 | 20 | api_server.configure() 21 | reactor.run() 22 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Google Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """Setup module for packet queue""" 16 | 17 | from setuptools import setup, find_packages 18 | from codecs import open 19 | from os import path 20 | 21 | setup( 22 | name='packet_queue', 23 | version='0.1.0', 24 | zip_safe=False, # python-iptables doesn't work well with eggs 25 | 26 | description='Packet-based impaired network library', 27 | packages=find_packages(exclude=['contrib', 'docs', 'tests']), 28 | package_data={'packet_queue': ['web/*']}, 29 | include_package_data=True, 30 | 31 | install_requires=[ 32 | 'twisted', 'python-iptables', 'netifaces', 33 | ], 34 | scripts=[ 35 | 'scripts/impaired_network_server', 36 | 'scripts/impaired_network_shell', 37 | 'scripts/impaired_network_clear_iptables', 38 | ] 39 | ) 40 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Google Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # 16 | # docker build -t