Exemplo n.º 1
0
def main(argv):
    # Parse options
    import argparse
    parser = argparse.ArgumentParser()

    group = parser.add_argument_group("upstream options")
    group.add_argument("-c", "--connect", dest="connect",
                       metavar="HOST[:PORT]",
                       help="Sets the address the proxy should connect to. "
                            "If not given, the proxy connects to the address "
                            "requested by the user. You probably want to set "
                            "this.")
    ProfileCLI.make_parser(group)
    group = parser.add_argument_group("downstream options")
    group.add_argument("-l", "--listen", dest="listen",
                       metavar="HOST[:PORT]",
                       help="Sets the address the proxy should listen on. "
                            "If not given, the proxy listens on port 25565 on "
                            "all interfaces.")
    group.add_argument("-o", "--online-mode", dest="online_mode",
                       action="store_true",
                       help="If given, users connecting to the proxy are "
                            "authenticated by the Mojang session servers, "
                            "i.e. the server bit of the proxy is running in "
                            "online-mode.")
    group.add_argument("-v", "--protocol-version", dest="protocol_version",
                       type=int,
                       help="Sets the protocol version that the proxy "
                            "accepts from connecting users. If not set, the "
                            "proxy will attempt to use whichever the user "
                            "requests.")
    group = parser.add_argument_group("sniffer options")
    inner_group = group.add_mutually_exclusive_group()
    inner_group.add_argument("-p", "--packet", dest="packets",
                             action="append",
                             metavar=("DIRECTION", "NAME"),
                             nargs=2,
                             help="Adds a packet to be sniffed. "
                                  "DIRECTION should be one of: "
                                  "'up' (client --> server), "
                                  "'down' (server -> client).")
    inner_group.add_argument("-d", "--direction", dest="direction",
                             choices=("up", "down"),
                             help="Only sniff packets heading in a particular "
                                  "direction.")
    group.add_argument("-x", "--print-payload", dest="print_payload",
                       action="store_true",
                       help="Prints a hexdump with attempted ASCII "
                            "interpretation of the payload of sniffed "
                            "packets")
    group.add_argument("-y", "--dump-payload", dest="dump_payload",
                       metavar="DEST_PATH",
                       help="Dumps the payload of sniffed packets to the "
                            "specified directory")

    args = parser.parse_args(argv)
    run(args)
    reactor.run()
Exemplo n.º 2
0
def main(argv):
    parser = ProfileCLI.make_parser()
    parser.add_argument("host")
    parser.add_argument("port", nargs='?', default=25565, type=int)
    args = parser.parse_args(argv)

    run(args)
    reactor.run()
Exemplo n.º 3
0
def main(argv):
    parser = ProfileCLI.make_parser()
    parser.add_argument("host")
    parser.add_argument("-p", "--port", default=25565, type=int)
    args = parser.parse_args(argv)

    run(args)
    reactor.run()
def main(argv):
    parser = ProfileCLI.make_parser()
    parser.add_argument("host")
    parser.add_argument("-p", "--port", default=25565, type=int)
    args = parser.parse_args(argv)

    xcoor = input("Enter x coordinate: ")
    ycoor = input("Enter y coordinate: ")
    zcoor = input("Enter z coordinate: ")

    run(args, xcoor, ycoor, zcoor)

    reactor.run()
Exemplo n.º 5
0
def client_forward_packet(encrypt_tcp_q, decrypt_tcp_q, forward_addr):
    """
    Starts twisted's event listener for sending and recieving minecraft packets,
    and sets up the client bot to connect to the proper host machine using the
    runargs function. Also passes the encrypt_tcp_q (for forwarding encrypted
    packets) and the decrypt_tcp_q (for receiving encrypted packets) to the
    minecraft client encoder object.
    """
    parser = ProfileCLI.make_parser()
    parser.add_argument("host")
    parser.add_argument("-p", "--port", default=25565, type=int)

    #Later take input and/or pick from a name in a database
    myarr = [forward_addr, "--offline-name", "Notch"]
    args = parser.parse_args(myarr)
    runargs(args, encrypt_tcp_q, decrypt_tcp_q)
    reactor.run()