SSH to RaspberryPi which is connected via iPhone Hotspot - iphone

I have a RaspberryPi which is configured to automatically connect to my iPhone's wifi hotspot. I need to take the RaspberryPi to various locations for testing, and I often need to leave it at a location for extended periods of time (without my iPhone hotspot there). The RaspberryPi needs an internet connection in order to complete the testing properly.
I am trying find a solution which would allow me to SSH (or connect some other way) into the RaspberryPi while it is connected to my iPhone's wifi hotspot. This would allow me to add a new wifi network/password when I move to a new location (I usually can't get the wifi network/password in advance). In other words, I would move into a new location, the RaspberryPi would be connected to my hotspot and would begin testing, and once I obtain the wireless network/password for that location, I want to connect to the RaspberryPi to add that information so it can connect to the location's wifi network instead of my hotspot.
I don't have a portable monitor for the RaspberryPi so I can't just hook it up to a screen and make the changes that way.
Does anyone have any suggestions? Thanks in advance.

On the phone running this hotspot, I am assuming you can install apps that permit you to SSH into the Pi, headless? I'm doing this regularly, my choice app is JuiceSSH.
Alternately, a laptop connected to the same phone hotspot running an SSH client such as Putty can connect to the Pi across the same AP, also headlessly. You can update your WPA_supplicant file and reboot the Pi, making sure to bring down your hotspot before it fires up again and joins the new AP. I'm also doing this regularly.
Given the time (4 months) that's passed, you've likely figured this out already...

Related

2 router in cascade with 2 DHCP and remote access

The installation is in a holidays house (so no permanent internet access)
I have a 4g-Routerm (ROUTER-1 = huawei B525-b23) that enable the internet access. I switch it on one day a week.
I have another router (ROUTER-2 = GL-MT300N-V2).
ROUTER-2 is always plugged on electricity.
On ROUTER-2 is connected through ethernet port a Raspberry-Pi3 (with Home Assistant on it).
On ROUTER-2 is connected through WIFI a Camera IP
ROUTER-1 and ROUTER-2 are connected together through ethernet.
When ROUTER-1 is not plug to electricity, none have acces to internet, but it's not an issue.
The camera save picture on the Rapbery Pi3, the Home Assistat is recording some sensor data.
When I switch on the electricity on the ROUTER-1, everyone have access to internet.
What I want is to have remote Access to my router-2 and my Rasberry and my Camera when ROUTER-1 is online
How should I do ?
Hi I can think of two solutions for this setup but both involve buying a second hand cheap router.
I think the use of a single router would make this setup a lot easier. Any router would work that supports:a USB 4g Modem to be attached to it, and has support for setting up a openvpn server and you need to be OK with leaving the Internet on all the time just make sure you dont have any services running that use up bandwidth and you should be ok. You can can connect both raspberry pi and IP camera to that router. Setup Openvpn server open the UDP port required and download the certificates, You should be able to vpn into your network and manage it through SSH or something remotely.
The second option is tailored to you but still requires swapping the 4G Modem with another one that supports these things: Wake on LAN, openvpn server, supports ssh into it over LAN and either has 4G support through a sim card slot or a usb port with modem support.
You can then have it setup so this new Router-1 is switched off with wake on lan configured on it and the raspberry pi to send the magic packet. You can use something like this to get an idea of how WoL https://www.lifewire.com/wake-on-lan-4149800. You can use cron on your raspberry pi to send WoL signal to Router 1 once a week which would eventually give you internet access once the router is up. You have to setup a vpn server on it and forward the required port and download the certificates. When your scheduled WoL cron runs make sure you are able to connect through vpn then access network resources you wish, at the end when you are done you can ssh into the router-1 and turn it off.
I hope this helps. I had a look at the router models you are using and it doesnt leave you with many options. You can get cheap second hand routers online that support everything that is required.

Turn off raspberry Pi with Kodi remotely

Let me explain my problem: I have a raspberry Pi with Kodi installed and I use it with a IPTV service. This service only allow me to use it in one device at a time and sometimes I want to use it on my phone.
I'd like to be able to turn off my raspberry remotely so I can watch it in my phone whenever I want. I tried to create a web server that would allow me to run a script that would turn off the device but I can't access it because the raspberry IP takes me to some kodi stuff.
So to sum up, I'd like to go to my raspberry IP with Kodi installed, press a button and turn off the device. The web stuff I can take care of.
Any thoughts?
The only safe way to do this is to have a VPN tunnel that lets you access your internal network. This is much safer than opening up a port to Kodi on your router. It would just attract every bot and hacker out there.
Once you have a working VPN tunnel between your home network and your smartphone, just use a Remote Control App to shut Kodi down cleanly.
You can use a Kodi remote app for your mobile device. E.g. Kore (official remote app for Android) does have a shutdown button.
I think the best and easy way is to install dataplicity in your Raspberry Pi and access via dataplicity web or the app (Android or iOS) to the Terminal and use the command: sudo shutdown -h now or sudo poweroff

Fetch Device IP Addresses/MAC address of devices connected to a LAN

Currently I am wondering how I would go about implementing a fetch request to a local wireless network (router) to obtain all devices currently connected to a currently connected LAN....
So I've done some research and apparently 'nmap' is a terminal/commandprompt command that returns connected devices to a local wireless network, with some parameters that need to be inputted into the nmap command.
I found an iPhone app that does what I'm trying to do... https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDYQFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fip-network-scanner-lite%2Fid335517828%3Fmt%3D8&ei=qhHfUbDpJ4GkigKClIHYCg&usg=AFQjCNFMDPn5H8TbDw54-zYDYJ9iezRXpA&sig2=QN42a5w-MgClO5BvBUoDGw
It scanns for devices on a currently connected WiFi network and displays all devices connected to such network... I am attempting to do the same but am stuck on where to start...
Anyone have any ideas? I am trying to do this for iOS..
I'm thinking you could do a broadcast ping, ala:
$ ping -b 192.168.0.255
using the Apple sample code for ping.
But I have not tried it.

Redirect telnet 23 to COM Port via WIFI

I bought an Bluetooth ELM327 to read codes out of my cars diagnostic ports
I connect to it via Bluetooth in windows and it makes a serial-over-bluetooth com port 4
which any application running on my windows will connect quite happily.
I then found a few apps for the iphone and android etc that connect to these ELM gadgets via WIFI and not Bluetooth (because for some reason you cannot pair to these devices of iphone)
Now obviously I can buy a WIFI enabled ELM327 - but it costs £130 and my Bluetooth one cost £15
So after reading about this a bit I found out that the WIFI enabled ones you connect up as ad-hoc network and the smartphone(iphone) app tenets in port 23 that relays normal serial commands.
So obviously in the WIFI enabled one there must be some processor that runs an nano-os with telnet and some rs-323 translators and not sure what else.
How, using Windows 7 will i be able to relay any incoming WIFI requests for Telnet port 23 to my COM 4 that is connected to my Bluetooth ELM327 ..
As this is surely all that is needed by the Smartphone app.
You dont have to connect using a Bluetooth library like suggested ... because you are already connected to the device and have COM4 exposed to you. SO all you have todo is use a telnet library and translate and handle the handshake then realy the infomation as serial data.
There's no feature built in to Windows (or any other platform I know of) for such a scenario.
It would be fairly straightforward however to write a program to listen on port 23 and open a bluetooth connection when connected to, and then forward the data received on each connection out onto the other.
For instance one could use my .NET library 32feet.NET (e.g. http://32feet.codeplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections etc etc) along with TcpListener from the .NET framework class libraries.

Capturing network traffic while the application is running on iPhone and connected to xcode

Is there any way I can capture network traffic (using application like Ethereal, on Mac ) while the application is running on iPhone and connected to xcode
Thanks
Connect you mac using an ethernet cable. Share your network connection on the mac over your AirPort. Attach the iPhone to your Mac's ad-hoc network.
Run Wireshark or HTTPScoop on your mac and you will be able to see all traffic from the iPhone.
I'm no aware of any way to do this for the WAN connection though. I'd be surprised if it is possible.
To capture packets from your iPhone using Wireshark, you have to first get your device id for the phone from iTunes. Plug in your iPhone via USB to your Mac...then open iTunes and click the iPhone icon in top navbar.
You can't copy the UUID, so you have to write it down manually. After you have the UUID, you'll need to mount the device.
Open a terminal and type: rvictl -s <device-id>
I created an alias in ~/.bash_aliases as alias mntios='rvictl -s <device-id>' -- as long as you have the same phone your device UUID won't change, even if you re-install the OS.
Once you have the device mounted startup wireshark. brew install wireshark (see: http://brew.sh)
One of the network adaptors should be rvi0 -- this is the network interface for your iPhone.
Now you can capture packets -- double click it to start capturing.
If you want to filter for specific urls you can type a filter like: http.request.full_uri contains <string-in-url> to filter requests.
On your computer, run an HTTP debugging proxy like Charles (Mac) or Fiddler2 (Windows). In the phone's wi-fi settings, turn on the HTTP proxy, entering your computer's IP address and the port number of the proxy. Make the sure the proxy is configured to allow connections from your phone. (It may allow localhost-only by default.)