Wireshark. How to route traffic from iPhone - iphone

I'm trying to capture packets from my iPhone app. It does not use HTTP to communicate, but a custom protocol to connect with my server. I can not use Paros to monitor the packets sent.
Is it possible to proxy the date through wireshark just like you can with Paros for http?

You can't proxy the data through Wireshark, per se; the problem is to have Wireshark running somewhere where it can see the traffic passing by. (If you had command line only, you could run tcpdump and capture packets, and then load the dump file into Wireshark somewhere else that had a UI.)
Are you on a Mac? If so, plug your mac into ethernet so that it has an internet connection (or connection to your server, anyway). Then share your Mac's internet connection over its wifi. Connect to this wifi point using your iPhone. Run Wireshark on the Mac (promiscuous mode enabled), then use your iPhone app and watch Wireshark. No need to mess around with servers or forwarding X11 connections! You could do something very similar with a Windows PC too.

The best solution that works:
Connect your device thru USB and type these commands:
rvictl -s UDID (UDID = id of device, 32 chars, you can locate it in iTunes or 'Devices & Simulators' in Xcode)
sudo launchctl list com.apple.rpmuxd
sudo tcpdump -n -t -i rvi0 -q tcp
OR just sudo tcpdump -i rvi0 -n
If rvictl is not working install Xcode (or see -bash : rvictl: command not found, Mac book pro OS X 10.7.5 & Xcode 4.6)
For more info:
Remote Virtual Interface
http://useyourloaf.com/blog/2012/02/07/remote-packet-capture-for-ios-devices.html

Run wireshark on the server - you'll see the traffic there.

Related

Huawei E3331 is not detected as modem (to send sms)

$ lsusb
Bus 001 Device 014: ID 12d1:14fe Huawei Technologies Co., Ltd. Modem (Mass Storage Mode)
$ gammu-detect
; Configuration file generated by gammu-detect.
; Please check The Gammu Manual for more information.
[gammu]
device = /dev/ttyS2
name = Phone on serial port 2
connection = at
The modem is detected as mass storage. I want the modem to be detected as Modem/Networkcard
I have searched and tried and finally this worked for me
Solution 1:
- /etc/mode_switch.config and turn on the following flag:
DisableSwitching=1
Go to following folder and create the 12d1:14fe file
$ cd /etc/usb_modeswitch.d/
$ sudo tar -xzvf /usr/share/usb_modeswitch/configPack.tar.gz 12d1:14fe
Edit 12d1:14fe file and add following lines and save it
DefaultVendor=0x12d1
DefaultProduct=0x14fe
TargetVendor=0x12d1
TargetProduct=0x1506
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
If you remove the USB dongle and reconnect it. You have to run following command to bring it back in modem mode
sudo usb_modeswitch -c /etc/usb_modeswitch.d/12d1\:14fe
To auto detect the USB dongle as modem when it is connected then set following rule
sudo touch /etc/udev/rules.d/huawei_e3331.rules
Then create add following rules to file and save it
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14fe", RUN+="/usr/sbin/usb_modeswitch -v 0x12d1 -p 0x14fe -V 0x12d1 -P 0x1506 -M '55534243123456780000000000000011062000000100000000000000000000'"
$ gammu-detect > .gammurc
$ sudo gammu-detect > .gammurc
$ gammu identify
Device : /dev/ttyUSB0
Manufacturer : Huawei
Model : unknown (E3331)
Firmware : 21.146.07.01.158
IMEI : 869************
SIM IMSI : 412************
$ echo "test" | sudo gammu sendsms TEXT 070*******
you will receive a test message
First of all, make sure that your mobile card has 3G permission, that is, 186 mobile phone number, and other 2G mobile phone numbers can also have 3G permission;
Anyway, it is the Unicom card of Waupaca brand;
Second, isn't there a PC Suite in the software of connecting the mobile phone to the computer? In the middle of the software installation, you will be asked if you want to install the driver, which must be confirmed. After that, if you uninstall the software, you can version it, but you can't uninstall the driver;
Connect the phone cable to the USB port of the computer. There will be an Android adapter in the computer manager, which means the driver is installed;
When the mobile phone is connected to the computer, it can't turn on the U-disk mode;
Run daily up for Android on the computer... Just click Connect right
It takes a lot of traffic

How to do netcat with gawk networking?

I'm on machine that have very old netcat version which don't support HTTP proxy option (-X). And i need to do netcat through HTTP proxy on this machine (to proxyfy ssh with proxy command).
I've tryed to send CONNECT <host>:<port> with the old netcat before passing the stdin/out to ssh but without success.
I've found that gawk as networking support according documentation and I've tried to make netcat working with it but without success.
How to send CONNECT command first, read the response of the proxy and go in read/write stdin/stdout in two way loop after?

Using socat to use data coming from another machine

I have a Raspberry machine running a program which process data coming from a /dev/ttyUSB0 device.
I want to move that device to another machine and transfer the data to the initial machine so it appears as coming from the original machine.
I feel that socat might be the answer but I am lost in the parameters of the command.
Any help would really be appreciated
This seems to work.
On the server side (were the physical device is plugged):
sudo socat tcp-l:54321,reuseaddr,fork file:/dev/ttyUSB0,nonblock,b1200,cs7,parenb,waitlock=/var/run/ttyUSB0.lock
On the client side (where the program is, expecting data from ttyUSB0):
sudo socat pty,link=/dev/ttyUSB0,wait-slave tcp:my_server_ip:54321

Raspberry Pi VNC fail connection

I face a problem that I can ping to correct IP address, it have no loss. And also I use nmap ping the pi address, and I get it correctly. Then I using VNC viewer to try access to pi, but it always show up "The connection was refused by the host computer"
Did u all have any idea ?
Your problem indicates that your Raspberry Pi was reached by the connection attempt, but that no service was running on the relevant port and hence the connection was refused. I think, this is because the VNC service is not running on your Raspberry Pi.
Update 1
Raspbian now comes with the server by default thanks to a partnership with RealVNC, it just needs to be enabled.
Original
You must enable VNC Server on your Raspberry Pi using terminal
sudo apt-get update
sudo apt-get install realvnc-vnc-server
or you can also enable VNC Server on the command line using the sudo raspi-config command.
Advanced Options->VNC:Yes
Now you can connect to the VNC Server using a application such as VNC Viewer.
I have been having this issue with my Raspberry Pi Zero W even though it worked perfectly beforehand. This page https://www.realvnc.com/en/connect/docs/raspberry-pi.html should help.
I ran vncserver in a ssh window after verifying the interface settings in raspi-config.
It started the VNC Server and gave me the VNC Server catchphrase and the IP address with Port Number as shown in the photo linked below.
vncserver output
After running that command I was able to get the VNC Viewer on my windows machine to connect to the pi.
I then ran sudo systemctl enable vncserver-x11-serviced.service in the ssh window so that it would start automatically on subsequent reboots.
I've had this same problem but found a different reason. I found three ways to get around this error message.
Plug a mouse or keyboard into the Raspberry Pi zero, waking up the screen and the VNC connection.
Wait about 5 - 10 minutes which is the amount of time for the screen saver to kick in which seems to wake up VNC connection. but don't wait to long other wise run this command to get things going via ssh "systemctl start vncserver-x11-serviced.service".
I am hoping the new update they just published will fix this problem. I don't see this as much with the Raspi B3+ as with the Zero H.
The last was plug in both monitor and mouse and that for sure fixes the VNC issues but defeats the headless connection. It seems that running headless and the screen/saver are somehow related but just not smart enough to figure it out.
For people using newer version of Raspberry, VNC option is found under:
Config>Interface Options
pinging to any service will only tells us that whether the server is currently listening on that port or not. It will not tell you the possible result to connection request asked by client.
It seems that, you have installed VNC server but not started it properly. Use this command to start it...
# vncserver start
Also recheck the port number is correct or not.
With the Rasp Pi 4 - had connecting fail after rebooting both the server and client (both Rasp Pi 4s).
Took a while to realize that I have two clients: One named "VNC Client", the other "VNC Viewer for Google Chrome".
The former works, the latter doesn't.

Resolve hostnames with arch linux on a RaspberryPi

I have a Pi that runs hostapd and dhcpd on arch linux to create it's own land with the Pi's (routers) IP being 10.0.0.1. This uses the wlan0 interface and it only serves as a standalone router running a web server.
Once I connect to the Pi, I use 10.0.0.1 to display the web pages, but I want to use a hostname such as firepi. I have tried using dnsmasq, but I haven't been successful. Any help would be greatly appreciated especially if you can give me some detailed examples as I am a novice.
The purpose of this system is that I have created a web app that you can use to ignite fireworks over WiFi at a safe distance. I would just like the convenience of using a hostname instead of the IP address.
I must add that I will more than likely be using an iPhone to connect to the server, should this affect anything.
Not too sure how or why but this is what I did and it is successfully working now, so this is just for future users who may need a similar setup to mine.
First I installed hostapd and dhcpd and made sure they were working. Next I changed '/etc/hostname' to firepi and the '/etc/hosts' and added '10.0.0.1 firepi'. Then I installed dnsmasq, and set the interface to wlan0, and finally added '10.0.0.1 firepi' to '/etc/resolv.conf'.
After a full reboot, I joined the network on my iPhone, navigated to firepi and sure enough, it worked!
Thanks to the other users for their advice and tips.
You can use avahi on Arch as well to resolve your hostname:
sudo pacman -S avahi nss-mdns
Start the avahi daemon:
sudo systemctl enable avahi-daemon.service
sudo systemctl start avahi-daemon.service
Edit /etc/nsswitch.conf
sudo vim /etc/nsswitch.conf
Change the line:
hosts: files myhostname dns
to
hosts: files myhostname mdns_minimal [NOTFOUND=return] dns
Reboot
Note: don't forget to add .local to your hostname.
See also:
http://blog.pixxis.be/post/77285636682/resolve-hostname-with-arch-linux-on-a-raspberry-pi
If you just want to be able to use "firepi" as hostname to connect to it, you can simply add it to your /etc/hosts file using the syntax "IP host".
To make it as easy as possible, run this command as root:
echo "10.0.0.1 firepi" >> /etc/hosts
That'll do the trick.
Can you try avahi ?
sudo apt-get install avahi-daemon and
sudo apt-get install avahi-browse
I've successfully used that on Raspian. Unless you change the hostname using
sudo raspi-config you will access via raspberrypi.local
Note that if you plan to access the RPi from Windows you will need to install Bonjour Service first(if you have iTunes intalled, you might have those, run services.msc and check if the Bonjour Service is started)
Another note: On a friend's iphone I've installed a generic vnc client and had x11vnc running on the RPi and succesfully managed to connect to the RPi (since avahi-daemon was installed)