GithubHelp home page GithubHelp logo

softetherpy's Introduction

SoftEtherPy

SoftEther VPN Server Python Management API.

Python implementation of SoftEther VPN management protocol. Can be used for controlling remote server, automation or statistics.

Usage example

from softether.api import SoftEtherAPI

api = SoftEtherAPI('vpn.whitehouse.gov', 443, '123456password')

api.connect()
api.authenticate()

print(api.test())
# {'UniStrValue': ['world\x00'], 'IntValue': [1], 'Int64Value': [2], 'StrValue': ['1']}

print(api.get_server_info())
# {'OsVendorName': ['Unknown Vendor'], 'OsProductName': ['Linux'], 'KernelName': ['Linux Kernel'], 'ServerType': [0], 'ServerHostName': ['vpnserver'], 'OsServicePack': [0], 'ServerBuildDate': [1413977090000], 'OsSystemName': ['Linux'], 'ServerBuildInt': [9506], 'ServerVerInt': [411], 'ServerProductName': ['SoftEther VPN Server (64 bit)'], 'OsType': [3100], 'ServerFamilyName': ['SoftEther'], 'ServerBuildInfoString': ['Compiled 2014/10/22 20:24:50 by yagi at pc25'], 'ServerVersionString': ['Version 4.11 Build 9506   (English)'], 'OsVersion': ['Unknown Linux Version']}

print(api.get_server_status())
# {'TotalMemory': [0], 'NumSessionsTotal': [0], 'NumTcpConnectionsRemote': [0], 'Send.UnicastBytes': [577743326], 'Recv.BroadcastCount': [1224620], 'NumHubStatic': [0], 'FreePhys': [0], 'ServerType': [0], 'UsedPhys': [0], 'NumHubDynamic': [0], 'Send.BroadcastCount': [43225], 'NumTcpConnections': [49], 'AssignedBridgeLicensesTotal': [0], 'Send.UnicastCount': [1746888], 'AssignedBridgeLicenses': [0], 'NumSessionsLocal': [0], 'AssignedClientLicenses': [0], 'Send.BroadcastBytes': [3140072], 'NumHubStandalone': [1], 'Recv.UnicastCount': [1752958], 'NumHubTotal': [1], 'AssignedClientLicensesTotal': [0], 'NumGroups': [0], 'Recv.BroadcastBytes': [74615494], 'CurrentTime': [1418792416592], 'UsedMemory': [0], 'Recv.UnicastBytes': [580004599], 'FreeMemory': [0], 'CurrentTick': [3039999042], 'TotalPhys': [0], 'NumSessionsRemote': [0], 'NumUsers': [3], 'StartTime': [1415753738050], 'NumTcpConnectionsLocal': [49], 'NumIpTables': [1], 'NumMacTables': [1]}

api.disconnect()

softetherpy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

softetherpy's Issues

how to create a user with password?

It does not seem to password encryption function and enable security policy,

payload = {
'HubName': ('string', [hub_name]),
'Name': ('string', [name]),
'GroupName': ('string', [group_name]),
'Realname': ('ustring', [realname]),
'Note': ('ustring', [note]),
'CreatedTime': ('int64', [created_time]),
'UpdatedTime': ('int64', [updated_time]),
'ExpireTime': ('int', [expire_time]),
'NumLogin': ('int', [num_login]),
'AuthType': 1,
'Policy': {
'Access': ('int', [True]),
'MaxConnection': ('int', [2]),
}
}

Add documentation about how to setup the CGI endpoint for the API client

Hi, I've been reading the SoftEther documentation and I can't find anywhere where it says how to setup the VPN Server Management endpoints on the server that has SoftEther VPN installed.

In the fileapi.py in your project, I see the endpoint path is /vpsnsvc/connect.cgi, and I see this is also defined in a file in the source code of SoftEther itself, so is there a way to get this API client communicating with SoftEther VPN without having to write my own CGI scripts? It seems like this functionality must be provided by SoftEther, but I'm having a lot of trouble finding more information about this.

Any help would be greatly appreciated.

Thanks,

Source materials

I've been looking the management API spec and it looks like this library implements it, though it would be nice to see the API documentation. Does documentation exist? or did you just read the C source?

Access to IpTable

Is there any way to pull the clients private vpn IP via this API?

I've attempted to access IpTables and i'm met with {u'error': ['ERR_NOT_SUPPORTED']}
Is this a deficiency in SoftEther itsself?

How to get Virtual IP address list?

Hi,

I want to list users with their hubs, virtual IP's and online status. To obtain hubs i use "enum_hubs"method. For online status and vietual IP's i use "enum_session" and parse users according their username. But the IP that shown in "enum_sessions" is like: [1996662976]. I also tried "get_session_status" method, SessionStatus_ClientIp and ClientIpAddress also equals [1996662976]. When i run "enum_ip_table" the IP key gives [3247570601, 4278190047] value considered there is only one client connected to the server. If i try offical vpncmd interface or remote server manager i can see IP addresses without issue. Why this is happening?

Also i want to ask that what is the purpose of "key" kwarg in this method?

def enum_ip_table(self, hub_name=None, **key=None**):
        payload = {
            'HubName': ('string', [hub_name]),
            **'Key': ('int', [key])**
        }

        return self.call_method('EnumIpTable', payload)

Only 443 port can be used?

i use 5555 port to connect, it failes.(i can use vpn server manage to log in from this port)

shows:
in get_http_response
with self.socket.makefile('rb') as socket_file:
AttributeError: exit

enum_user error for too many users

enum_user works fine until you have less than 129 users, if users are more than 129 at one hub, script return error api_call_wrong_response_length .
Full response:

python test.py 
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    print(api.enum_user(hub_name="test"))
  File "/usr/local/lib/python2.7/dist-packages/softether/api.py", line 626, in enum_user
    return self.call_method('EnumUser', payload)
  File "/usr/local/lib/python2.7/dist-packages/softether/api.py", line 184, in call_method
    raise SoftEtherAPIException('api_call_wrong_response_length')
softether.api.SoftEtherAPIException: api_call_wrong_response_length

Connection error

Connection "CID-19" terminated by the cause "A client which is non-SoftEther VPN software has connected to the port." (code 5).

It's not working now?

I change the hashlib.new('sha') to hashlib.new('sha1'), but the api_authenticate is still not work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.