open wifi Captive portal w/only local net (no internet/wan)? - raspberry-pi

I am trying to set up a wireless 'test' box to use on a private club (11,000 acres). The initial tests won't need anything fancy, it will just be checking the visibility of a hotspot from a high-point in the middle of the property. But if it proves to have good visibility, later tests will be (hopefully) promoted by the club and made aware to members. I would like to set up a captive portal to redirect them to a comments page where they can post a quick message if they were able to connect and hopefully say what they think about the idea.
This is going to be going on a raspberry pi running debian wheezy. So the less overhead the better.
Most of the examples I see online of captive portal are based on having an internet connection and/or a NAT scheme set up. I just need a hotspot and a single web-page for these promotional tests. If possible, I would like to trigger any devices capable to suggest or otherwise open a browser to go to the promotional landing page. It would also be nice if some kind of dns masquerading or other mechanism was in place to redirect all browser traffic in the event their device doesn't support a pop-up.
Any help is appreciated.
EDIT 2022/06/05: With further testing and packet sniffing, it turned out that the android versions in question hard code the ip of the google server used for the 'online check' (8.8.8.8). When on an arbitrary IP, it's not looking for requests to 8.8.8.8 and thus it doesn't grab the online-check and won't redirect. If you set the AP to use this address (when not internet connected), the pop-up will usually trigger.
However, this solution is not ideal. Hacking the IP stack to specifically grab that request to 8.8.8.8 is outside my wheelhouse of knowledge. If anyone knows how to do this or has another potential solution, I would be interested in hearing it.

Related

Not able to connect to TCP server through APN

After googling thoroughly I finally decided to post my problem which is really giving me nightmares.
In my app I am trying to connect to a TCP server using the Network Carrier internet and using following connection string:
url="socket://"+ip+":"+port+";deviceside=true;connectionTimeout=30000;apn=;tunnelauthusername=;tunnelauthpassword=;";
I am able to connect to internet through the phone's browser but not able to connect to TCP server through app.
In my device APN authentication is disabled by default and APN,Userid/Password fields are blank thats why i have taken these parameters as blank valued in the connection string.
When i try to connect through wifi network using the string below:
url="socket://"+ip+":"+port+";deviceside=true;interface=wifi;connectionTimeout=30000";
I am able to connect to server but not in the case via APN.
Please help me out.
I am just stuck here and finding no way out.
Thanks
There are a variety of methods of connecting to a Server. What you are doing is specifying the method to use in the connection suffix which you set. The options that you can use in the connection suffix are documented in the BB KB article here:
Different-ways-to-make-an-HTTP-or-socket-connection
If you are supporting really old phones (pre OS 5.0), then this is the only option you have. But the trick with this is that you have to figure out what connection method is going to work on your device at the time you make the request. There is a load of code floating round the internet to do this, most of it dubious.
If you are OS 5.0 or above, then you can use a more advanced API, the ConnectionFactory, to make this easier, and in OS 6.0 even more advanced features. These are all documented on the BB Java microsite, see here:
BB OS Networking
The option you are using is the GCF framework. I recommend you investigate the "Network API" if you are supporting OS 5.0 and later only. You might also investigate the "Network API alternative for legacy OS".
This does not answer the frequent question, "how come the Browser can connect and I can't in my app?". This is because the Browser uses a special BlackBerry connectivity method referred to as BIS-B. The good thing about BIS-B is that it will work for any BB phone that has a BlackBerry tariff, and requires no configuration. The bad thing is that you do not get access to it as of right. To get access to it, the easiest thing to do is to ask for Push support, even if you are not planning on using it immediately but might in the future. This is documented on the page above.
But back to your question. The APN values in your TCP configuration being not set, does NOT mean you don't have to set them. The values specified in the Options are used as the default values should someone code ";deviceside=true" as a connection string - the idea being that users can set these for themselves and application developers don't code anything. These values are specific to your carrier. So search to find out what values you need to use. You will either put these values in the TCP Options (and so don't code them in your connection suffix), or put in your connection suffix. If you can't find out what you should put in there, you need to ask your carrier.
On most BlackBerry tariffs, using direct TCP through the APN may cost the user something for the data, and will also require configuration. Alternatively, you can use WAP 2, which may also cost for data, but doesn't require any configuration. The advantage of both these is that they will work on phones that are not using a BlackBerry tariff.
My recommendation is to look at connecting using ConnectionFactory (Network API), but this will only work for OS 5.0 and above.

How to detect Facebook friend IP via chat using Fiddler

So, I have read that it is possible to trace the IP of a Facebook friend while talking to him on chat by using Fiddler and Firebug. Now, as far as I am know, Facebook uses HTTPS and all in all, I cannot seem to get anything precise from Fiddler.
May anyone be kind enough to explain if this is really possible and if so, how the process goes?
I dont have a direct answer to your question, but i can give you some guidelines:
If the chat is working as a peer-to-peer network (which i highly doubt) you can trace the incoming tcp/udp connection and search it for the message using a sniffing program (like wireshark) and from there fetch their IP.
If the chat is based on that every message goes through a server (which is probably based on SOMM. not that it matters. (Server Oriented Messaging Model)). now if it is that way there is virtually no way to figure out the IP because the servers are acting as a proxy and masking the original IP, however. if FB includes some sort of meta data (which they do for location for phones etc.) that might contain the sender IP and some other stuff like the mac address etc etc. now i'm not sure of that but its a good place to look.
If you want help with firebug and all those other html/http/browser development tools there are plenty of tutorials out there. If you already know how to use it you might want to check the resources that's loaded when a message is sent. From experience i can tell that when a comment is added to something a whole bunch of crap happens that append stuff to the current html document. but i have never ever seen some meta data through that. anyway it's a good place to start.

Using the Facebook OpenGraph API without web server

I am trying to understand the openGraph API by downloading the SocialCafe example (based on a similar tutorial here). I am able to follow most of the steps in theory, but am unable to understand a few aspects:
The tutorial mentions that a link to the application is needed - a link such that facebook can issue an http GET request. If I do not have a web server, can I still run the application? I have seen some tutorials that specify localhost here on SO. Is that the route I must take to be able to have the sample source code reside locally on my machine and still be able to run the app on fb? If so, how do I set it up?
If I need a web server, is there a way I can turn my own machine into one? If so, how do I go about it?
I am coming from a DSP/C/C++ background and have very little web programming experience. Please do let me know in case some more details are needed.
You will need a publicly accessible web server for your development efforts. You can turn your localhost into one if you can get a static IP address from your ISP (pretty rare now-a-days to get one), then buy a domain name and set DNS up to point to your IP. On your computer you will need to install and configure a web server to use that IP and domainname combination. It takes about 48 hours for DNS to propagate the interwebs.
Your best bet it to purchase some web hosting along with a domain name (you're going to need one eventually once your app is out of development). Then you can run your app under a "sub domain" on your main domain (or in a sub folder on your production domain).

Peer-to-peer chat with the iPhone

I am aware of how many times this has been asked based on searching StackOverflow, but I am still hoping someone could tell me whether I am wrong...
I am creating a peer-to-peer chat app for the iPhone. My initial idea was to avoid using a server, so Bonjour came to mind. I was happy coding for quite a while and implemented a lot of fancy features, but two days ago I started testing with two clients from different subnets and found that the clients couldn't connect to each other! I suddenly realized that Bonjour is meant for local networks and that a DNS server is necessary for wide area service broadcasting. Do I really need a server for Internet peer-to-peer chat? Are there any other options that do not involve using a server on the iOS platform?
I am wondering how you can do a chat app without using a server. There are many cheap solutions out there, Amazon has its own service, Google does as well. You can try first without even having to pay a cent.
I found the following from apple developer guide. This should answer your question -
Does Bonjour work between multiple subnets?
Yes. The first release of DNS Service Discovery (DNS-SD) for Mac OS X concentrated on Multicast DNS (mDNS) for single-link networks because this was the environment worst served by IP software. Starting in Mac OS X 10.4, Bonjour now uses Dynamic DNS Update (RFC 2316) and unicast DNS queries to enable wide-area service discovery.
To answer the question, the only way is for you to carry a list of all possible participants, and their current IP address, and for each possible participant to report to all others each time their IP Address changes. So, if you have 100 possible participants, then you must tell 99 others when your IP Address changes, and those 99 must tell you when their IP Address changes.
Bonjour may work on a LAN, a WAN or even a WAN, but it will never work on the internet.
The role of the server is so that each end point only need to tell one end point (the server) when it changes. My advice is get a cheap internet host, with a basic PHP / MySQL capabilities, and write yourself a very simple script to post and get user identities.

See what website the user is visiting in a browser independent way

I am trying to build an application that can inform a user about website specific information whenever they are visiting a website that is present in my database. This must be done in a browser independent way so the user will always see the information when visiting a website (no matter what browser or other tool he or she is using to visit the website).
My first (partially successful) approach was by looking at the data packets using the System.Net.Sockets.Socket class etc. Unfortunately I discoverd that this approach only works when the user has administrator rights. And of course, that is not what I want. My goal is that the user can install one relatively simple program that can be used right away.
After this I went looking for alternatives and found a lot about WinPcap and some of it's .NET wrappers (did I tell you I am programming c# .NET already?). But with WinPcap I found out that this must be installed on the user's pc and there is nog way to just reference some dll files and code away. I already looked at including WinPcap as a prerequisite in my installer but that is also to cumbersome.
Well, long story short. I want to know in my application what website my user is visiting at the moment it is happening. I think it must be done by looking at the data packets of the network but can't find a good solution for this. My application is build in C# .NET (4.0).
You could use Fiddler to monitor Internet traffic.
It is
a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. Fiddler allows you to inspect traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.
It's scriptable and can be readily used from .NET.
One simple idea: Instead of monitoring the traffic directly, what about installing a browser extension that sends you the current url of the page. Then you can check if that url is in your database and optionally show the user a message using the browser extension.
This is how extensions like Invisible Hand work... It scans the current page and sends relevant data back to the server for processing. If it finds anything, it uses the browser extension framework to communicate those results back to the user. (Using an alert, or a bar across the top of the window, etc.)
for a good start, wireshark will do what you want.
you can specify a filter to isolate and view http streams.
best part is wireshark is open source, and built opon another program api, winpcap which is open source.
I'm guessing this is what you want.
capture network data off the wire
view the tcp traffic of a computer, isolate and save(in part or in hole) http data.
store information about the http connections
number 1 there is easy, you can google for a winpcap tutorial, or just use some of their sample programs to capture the data.
I recomend you study up on the pcap file format, everything with winpcap uses this basic format and its structers.
now you have to learn how to take a tcp stream and turn it into a solid data stream without curoption, or disorginized parts. (sorry for the spelling)
again, a very good example can be found in the wireshark source code.
then with your data stream, you can simple read the http format, and html data, or what ever your dealing with.
Hope that helps
If the user is cooperating, you could have them set their browser(s) to use a proxy service you provide. This would intercept all web traffic, do whatever you want with it (look up in your database, notify the user, etc), and then pass it on to the original location. Run the proxy on the local system, or on a remote system if that fits your case better.
If the user is not cooperating, or you don't want to make them change their browser settings, you could use one of the packet sniffing solutions, such as fiddler.
A simple stright forward way is to change the comupter DNS to point to your application.
this will cause all DNS traffic to pass though your app which can be sniffed and then redirected to the real DNS server.
it will also save you the hussel of filtering out emule/torrent traffic as it normally work with pure IP address (which also might be a problem as it can be circumvented by using IP address to browse).
-How to change windows DNS Servers
-DNS resolver
Another simple way is to configure (programmaticly) the browsers proxy to pass through your server this will make your life easier but will be more obvious to users.
How to create a simple proxy in C#?