after searching for a while i found that the only best source available to establish a vpn connection programmatically in mac is at
http://lists.apple.com/archives/Macnetworkprog/2011/May/msg00032.html
but i was struck at the 5th point while coding which says about kSCNetworkProtocolTypePPP and there is no such thing...
has anybody done it as shown in the above link
or is there any other source available...?
but i was struck at the 5th point while coding which says about kSCNetworkProtocolTypePPP and there is no such thing...
There is no need to fetch the PPP protocol, you can apply the settings directly to the interface you created. If you created the interface like this:
interface = SCNetworkInterfaceCreateWithInterface(bottomInterface, kSCNetworkInterfaceTypePPP);
you can apply the PPP options directly using:
SCNetworkInterfaceSetConfiguration(interface, myOptions)
You'll have to apply the shared secret using
SCNetworkInterfaceSetExtendedConfiguration(interface, CFSTR("IPSec"), myOptions)
And if you want to enable "Send all traffic over VPN", you'll need to apply those settings by fetching the IPv4 protocol first:
SCNetworkProtocolRef protocol = SCNetworkServiceCopyProtocol(service, kSCNetworkProtocolTypeIPv4);
SCNetworkProtocolSetConfiguration(protocol, myOptions)
The source code mentioned in this answer was extracted from https://github.com/halo/macosvpn/blob/master/macosvpn/Classes/VPNController.m where you can find it in its entirety.
Related
I am trying to add DNS over TLS (DoT) protocol to the zgrab2 tool. I used the zgrab2 documentation but I am not able to figure it out. Has anyone added a new protocol that is not there like port 853? ZGrab2 has the common ports but not post 2015.
From my understanding, you need to write your own code for DNS over TLS (DoT) in golang,
and then run an integration test on it. I understand the latter but have no idea how to create a module for port 853.
Would appreciate any suggestions or useful links anyone has. Thanks!
I am running a VPN in windows 10 desktop (using OpenVPN) and the VPN is the default gateway, so that all traffic by default goes through the VPN tunnel.
However, I would like to exempt certain apps from the VPN, so that their traffic goes directly out the physical interface instead, by passing the VPN (so-called "split tunnelling")
I assume this solution would involve the WFP (Windows Filtering Platform) API, and perhaps the Windows equivalent of
setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, device, sizeof(device))
I have this working in Linux currently via "cgroups" and policy-based routing/multiple routing tables.
But it is my understanding that Windows has neither policy based routing or multiple routing tables. But i can still think of a way of achieving this in Windows, but I cannot find the APIs to make it happen
One way is to hook the socket creation of a specific app and then use the windows equivalent of SO_BINDTO_DEVICE socket option (setsockopt()) to force the socket to be bound to the physical interface rather than the tap driver.
But, again, I cannot find the relevant APIs to make the above happen.
So I have a few questions:
(1) Is what i want to do possible within the given APIs of WFP (Windows Filtering Platform) or Windows APIs in genral? if so, which APIs do you advise i look at?
(2) Or, must i write a "WFP call-out driver" ? If so, would you be able to point me towards some resources for this, and possibility a good starting point for my particular problem? :)
(3) Is there anything else I might be missing? a simpler approach to achieve what i want? I know that it is possible in windows, as i have see the feature in some VPNs, but i would like to replicate it in my own personal VPN :)
Yes, you can force an app to use your VPN connection by copying and editing your (Windows) VPN connection.
Open the run prompt with: WIN+R
Type: ncpa.cpl
Copy your "old VPN" to APP_VPN (for example)
Open a Normal user Powershell
Change the new VPN connection with:
Add-VpnConnectionTriggerApplication -Name "APP_VPN" –ApplicationID "C:\path-to-your\game.exe" -Force
# Enable (Application) split-tunneling
Set-VpnConnection -Name "APP_VPN" -SplitTunneling $True
You can also check the VPN settings details in the phonebook in:
C:\Users\<User>\AppData\Roaming\Microsoft\Network\Connections\Pbk
Done!
I am using Ubuntu 16.04, ZoneMinder v1.29.1 with this docker and this camera(hikvision ir panoramic fisheye). I can connect to the camera and I get the camera interface for settings etc. The problem is the live views need a windows dependent plugin, that's why I wanted to use ZoneMinder.
Now I configured everything according to this guide. Basically I had to add a monitor, set the source to remote, set the protocol to rtsp, set the method to rtp/rtsp, set the host name to < user>:< pw>#< correct-ip>, set port to the rtsp port reported by the camera webinterface and set the host path to all possible things: I tried /Streaming/Channels/[1,2,3,4]/ and /live and /Streaming/Channels/[101,102,103]-[401,402,403,404]/ but I never had a live stream. I really don't know what I am doing wrong. Does anybody know the right host path or any other issues that could prevent me from receiving a live feed? According to this site the hikvision products should work with ZoneMinder. Maybe I am just missing something small and stupid, thank you.
EDIT:
I used ONVIF Device Manager to detect my rtsp stream: It is rtsp://< ip>:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_101 and I use exactly those settings in ZoneMinder but it does still give me a 404 error on the video.
Most Hikvision cameras don't work with the "Remote" option, but with the "Ffmpeg" option.
Source should begin with rtsp://"username":"passwd"#"IP-ADDRESS cam":554 and sometimes you have to append things like /cam/realmonitor?channel=1&subtype=0?tcp
Protocol should be RTP/Unicast
Is there a way to get a notification when a new Wifi Network has been detected?
I glanced through the Native Wifi API Reference and found the WlanRegisterNotification function but I'm not sure if that includes what i am looking for. The remark does not mention it.
Yes, WlanRegisterNotification is indeed the correct function. You need to do a little digging in the documentation to find exactly what each notification provides, by looking at WLAN_NOTIFICATION_DATA (in the remarks section for WlanRegisterNotification), then WLAN_NOTIFICATION_ACM†. Specifically, you're looking for one of these two notifications:
wlan_notification_acm_network_available Which gives a notification when a connectable network is detected, and you're not currently connected to another network, and there isn't an automatic connection available.
wlan_notification_acm_scan_list_refresh (Windows 8+)
† ACM stands for "auto configuration module"
How to send image from server to client through bluetooth in j2me?
If you are in control of both the server and client, then you don't need to worry about the complexities of OBEX. You can create your own lightweight protocol that does only what you need.
If you are new to Bluetooth on J2ME, start by reading about JSR 82. You'll want to create an RFCOMM/SPP connection between your client and server.
Next is the matter of sending an image over a serial connection in J2ME. If you have the image loaded as a javax.microedition.lcdui.Image, you'll need to obtain the ARGB pixel data using Image.getRGB().
This gives you an int array, which you'll need to send over the SPP connection (look at DataOutputStream.writeInt()), and rebuild at the other end using Image.createRGBImage().
HTH.
I've found the avetana Bluetooth libraries to be a bit unstable, and found BlueCove to be a better proposition. As mentioned, OBEX is the OBject EXchange protocol to use, and the docs are all over the internet.
If you look into "apps\BluetoothDemo\src\example\bluetooth\demo" folder of Sun WTK 2.5.x installation folder, you can find BTImageServer.java and BTImageClient.java source codes.
It uses serial profile to send image data from server to client. I think you can easily understand by looking it.
If you mean OBEX, try avetana (obex implementation on JSR-82) - it includes some example.