Tun/Tap Driver using OpenVPN and DeviceIoControl

A

Andrew

Hello I am trying to port some code and I am running into some issues I
may or may not be able to solve on my own and would appreciate your help

Basically I am trying to open the Tun Driver through openvpn in Ether
(Tap mode).

code is as follows

f = win32file.CreateFile("C:\\WINDOWS\\System32\\drivers\\tunmp.sys",
GENERIC_READ, 0, None, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
if WINDOWS:
ifs = win32file.DeviceIoControl(f, TUNSETIFF,
struct.pack("16sH", "wj%d", TUNMODE), 0, None)
else:
ifs = ioctl(f, TUNSETIFF, struct.pack("16sH", "wj%d", TUNMODE))
ifname = ifs[:16].strip("\x00")
print "Interface %s created. Configure it and use it" % ifname

but does not seem to work so well I get "The Paramater is incorrect"

Traceback (most recent call last):
File "wifi.py", line 167, in <module>
ifs = win32file.DeviceIoControl(f, TUNSETIFF, struct.pack("16sH",
"wj%d", TU
NMODE), 0, None)
pywintypes.error: (87, 'DeviceIoControl', 'The parameter is incorrect.')


Would appreciate any help

Ty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top