Linux or Linux virtual machine bridging mode uses PYTHON2 authentication drcom

Source: Internet
Author: User
Tags ord

Now many colleges and universities are using drcom client to manage the students ' Internet traffic and other information

Under Linux drcom client version Some schools may not be published

We can use Python to simulate landing drcom

The most important is the authentication server address

This need to grab packet analysis out of ip, self-google, it is easy to achieve

Run the py script under Linux (Python2 must be installed)

Command Line: python drclient.py

Attached below drclient.py

#!/usr/bin/env python#-*-coding:utf-8-*-import socket, struct, timefrom hashlib import md5import sysimport osimport RA  ndom# configserver = ' #认证服务器地址username = ' #账号password = ' #密码CONTROLCHECKSTATUS = ' \x08 ' adapternum = ' \x01 ' host_ip = ' #ipv4地址IPDOG = ' \x01 ' host_name = ' drcomfucker ' Primary_dns = ' #DNS服务器dhcp_server = ' #DHCP服务器AUTH_VERSION = ' \x 08\x00 ' Mac = 0xMac address #Mac地址host_os = ' Windiaos ' keep_alive_version = ' \xdc\x02 ' auth_version = ' \x0a\x00 ' Ipdog = ' \x01 ' # Config_endnic_name = ' #Indicate your nic, e.g. ' eth0.2 '. nic_namebind_ip = ' 0.0.0.0 ' class challengeexception (Exception)    : def __init__ (self): passclass loginexception (Exception): def __init__ (self): passdef bind_nic (): Try:import fcntl def get_ip_address (ifname): s = socket.socket (socket.af_inet, socket. Sock_dgram) return socket.inet_ntoa (fcntl.ioctl (s.fileno (), 0x8915, # SIOCGIFAD DR Struct.pack (' 256s ', ifname[:15])) [20:24]) return get_ip_address (nic_name) except Importerror as E:print (' Ind        Icate NIC feature need to be run under Unix based System. ')        Return ' 0.0.0.0 ' except IOError as E:print (nic_name + ' is unacceptable! ') Return ' 0.0.0.0 ' Finally:return ' 0.0.0.0 ' if nic_name! = ': bind_ip = bind_nic () s = Socket.socket (socket.af_ INET, Socket. Sock_dgram) # s.setsockopt (socket. sol_socket, SOCKET. so_reuseaddr, 1) s.bind ((bind_ip, 61440)) s.settimeout (3) SALT = "is_test = true# specified fields based on versionconf ="/ etc/drcom.conf "unlimited_retry = trueexception = Falsedebug = False #log saves to Filelog_path = '/var/log/drcom_client.lo    G ' If Is_test:debug = True Log_path = ' Drcom_client.log ' def LOG (*args, **kwargs): s = '. Join (args) print S        If Debug:with open (log_path, ' a ') as f:f.write (s + ' \ n ') def challenge (svr,ran): while True: t = struct.pack ("

  

Linux or Linux virtual machine bridging mode uses PYTHON2 authentication drcom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.