iOS Network Extension : Local VPN - vpn

I am trying to create a VPN, but without any VPN server. I am not sure if this is possible or not, but I Have seen apps which creates VPN and their VPN configuration ther server address is 127.0.0.1
I am using NEVPNProtocolIPSec
let p = NEVPNProtocolIPSec()
p.username = "ScreenCoach"
p.serverAddress = "MY_DEVICE_IP_ADDRESS"
p.authenticationMethod = NEVPNIKEAuthenticationMethod.sharedSecret
let kcs = KeychainService();
kcs.save(key: "SHARED", value: "AppDemoKey")
kcs.save(key: "VPN_PASSWORD", value: "rootuser")
p.sharedSecretReference = kcs.load(key: "SHARED")
p.passwordReference = kcs.load(key: "VPN_PASSWORD")
p.useExtendedAuthentication = true
p.disconnectOnSleep = false
In the serverAddress I have tried 127.0.0.1 , 0.0.0.0 and also my device's IP Address but nothing seems to work, and I am getting error alert message : The VPN server did not respond.
I don't know much about networking stuff, so can anyone please guide me here?
Thanks in advance.
EDIT
My Goal : Use custom DNS server for all the DNS queries throughout the device, without using an actual VPN server, so just a proxy VPN with DNS settings. Also I can not use NEDNSSettingsManager because iOS 12 is our minimum target.

Related

How to reach a restrserve api from rstudio server on aws?

I am trying out the very interesting package RestRserve from with RStudo server that I installed on an AWS instance.
This is de code I use:
library(RestRserve)
app = Application$new()
app$add_get(
path = "/hello",
FUN = function(request, response) {
response$set_body("Hello from RestRserve")
})
backend = BackendRserve$new()
backend$start(app, http_port = 8080)
I think the app is up and running, the message seems right:
{"timestamp":"2020-01-26 07:42:30.957686","level":"INFO","name":"Application","pid":1872,"msg":"","context":{"http_port":8080,"endpoints":{"HEAD":"/hello","GET":"/hello"}}}
-- running Rserve in this R session (pid=1872), 2 server(s) --
(This session will block until Rserve is shut down)
However, when I try to reach the app using the ip address of the instance like this: http://35.180.45.129/hello the browser says the site can't be reached.
Did I miss something? Any ideas about why this doesn't work?
Likely you need two additional steps:
make sure you allow traffic from internet to 8080 port
make sure you use public IP (or better DNS) of your instance

HTTP Adapter not working on real Android device-Mobilefirst platform

referring to my previous post.
Using Worklight(MFP) HTTP Adapters with REST/JSON Services
To solve the issue i had to change the value of the host name in the mobilefirst development server from "localhost" to the ip address of my pc so that it works on the android emulator. While installing the .apk file on a real device it does not work. I think when i get the .apk, the ip address i set in the hostname(the ip of my pc) is applied in the
/android/native/assets/wlclient.properties
wlServerProtocol = http
wlServerHost = 192.168.1.2
wlServerPort = 10080
can i have some help please. Thanks.
The IP address that is used by the client application is indeed controlled by the wlclient.properties file.
You can edit this file before building the .apk.
You can also:
Right-click on the MobileFirst application folder -> Run As -> Build Settings
Change the IP address
Build again
From now on, the IP address inside wlclient.properties will be the one you specified above in step 2.

Socket.Connect to SMTP to verify email always returns with smtp connection timeout

I've written a tool that validates emails, mostly copied from various examples on the subject around on the internet (user Don Worthley compiled a decent collection of code samples here https://delicious.com/dworthley/email.validation). Unfortunately after creating the socket and the IPEndPoint from the email to verify's hostname IP and port, my code always fails to connect to the socket due to timeout.
Here is the pertinent code (fails at s.Connect(endPt) due to timeout):
private bool smtpCheckEmail(string email)
{
try
{
string[] host = (email.Split('#'));
string hostname = host[1];
IPHostEntry IPhst = Dns.GetHostEntry(hostname);
IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25);
using (Socket s = new Socket(endPt.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
{
try
{
s.Connect(endPt);
}
catch
{
s.Close();
return false;
}
From my research others have reported success with similar code so it might be an issue with my server host. The MVC project is on a GoDaddy VPS with Windows 7 and standard firewall/MSSE as protection (I've tested with both disabled with same timeout result).
I've verified I can telnet to my own host and run through the various HELO, Mail from etc commands but it also times out if I try to connect to smtp for other hosts.
Maybe it's an ISP issue?
I've also tried installing EmailVerify for .NET trial but run into the same problem where any validation at or above SMTP check times out.
Would be great to get some suggestions of what might be the problem and how to troubleshoot it.
Edit: After doing some comparison testing with one of my Azure VPS it looks like it is likely to be server related, "telnet 74.125.206.108 smtp" (gmail's smtp host IP) through command line connects on the Azure box but not on the GoDaddy one my project is on.
I also notice that when my code pulls the IP from the host name (Dns.GetHostEntry(hostname)), in this gmail example it returns 216.58.216.37 which matches what I get if a run nslookup in cmd for gmail.com, however the IP for smtp that I can telnet to is for gmail is 74.125.206.108 which matches the nslookup record for smtp.gmail.com. Could my code be grabbing the wrong IP addresses in many cases here?
Turned out to be a limitation of GoDaddy VPS. Transferred code to an Azure hosted project and it worked great.

JavaDB(Derby) - Connection refused using Network Server Controller in LAN

I'm new to java networking. My scenario here is 2 client computers are connecting to a server hosted in LAN. So I use NetworkServerControl API to start the host:
private static void startServer(){
try{
NetworkServerControl nsc = new NetworkServerControl(InetAddress.getByName("localhost"), 1527);
nsc.start(null);
}catch(Exception e){
JOptionPane.showMessageDialog(null, "Start network error : " + e.getMessage());
}
My questions are:
1) Is localhost accessible by computers in LAN?
- If yes, I tried to use ij to connect derby database in the server but it wrote connection refused. Anything I missed out?
ij: CONNECT 'jdbc:derby://localhost:1527/c:/app_db/' user 'xxx' password 'xxx';
- If no, what is the common approach should be used? Please guide me the right track.
Thanks.
To access your Derby database from other machines on the network, you need to change "localhost" to a different value. You can give the DNS name of your machine, or the public IP address of your machine.
Note that you have to make this change both on the Derby server and on each of the client URLs.
You should be able to use netstat -a to confirm the effects of your changes on the server.

How to host a TcpClient/listener online (I want to host my chat server online)

I have a chat server that i create for my window phone app. Right now it working on my local computer, how do i make it online so everyone can connect to it.
Chat server:
TcpListener chatServer = new TcpListener(4296);
Chat client:
TcpClient client = new TcpClient("127.0.0.1", 4296);
How do i forward the port so i can host it online!
In order for the world to see it you need to host it somewhere with a public IP address. You will then use this IP address in the client connection:
Chat client: TcpClient client = new TcpClient("xxx.xxx.xxx.xxx", 4296);
Depending on your platform you could use Google App Engine or Amazon Web Services to quickly deploy your application.
That depends on your router/gateway. Check your router's documentation for more information how to forward ports.
Basically If you want to deploy your app online you need your own Domain(you get your own IP to host), you can use Cloud Server to deploy(these is a good option, since you can deploy for free but storage is limited in free edition), Or else you can Host on your Routers IP Address.
If you are using first two option then these is a python script to start a listener service on given IP and port.
Here:
import socket
import sys
HOST ='' # Symbolic name, meaning all available interfaces
PORT = 8000 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
try:
s.bind((HOST, PORT))
except socket.error as msg:
print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
sys.exit()
print 'Socket bind complete'
#Start listening on socket
s.listen(10)
print 'Socket now listening'
#now keep talking with the client
while 1:
#wait to accept a connection - blocking call
conn, addr = s.accept()
print 'Connected with ' + addr[0] + ':' + str(addr[1])
s.close()
These is just a sample, you can put all of Your code from Your PC to Cloud and edit the changes in IP.
And if you want your router to listen to the client then you have to go to the routers login page, for most of the router it is 192.168.51.1, go here and login as administrator, Then you should go to firewall configuration over there you will find an option of custom server, then click on it and then there configure the ip address, port,etc to host.
I prefer you to watch these full video to understand properly: Here Video
In these video he is hosting for exploitation purpose you can host to do any other activity.
Thank You.

Resources