SkinBlues has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm pretty new to Perl and new to networks also. I am trying to figure out if it is possible to communicate from my mac laptop to my iPhone. I want to be able to send a message somehow from my computer to my phone. I am playing around with the commands nc (netcat), netstat, ipconfig, lsof. Any pointers in the right direction would be much appreciated! thank you!
  • Comment on Can I communicate with my phone from my computer?

Replies are listed 'Best First'.
Re: Can I communicate with my phone from my computer?
by tobyink (Canon) on Dec 10, 2019 at 23:34 UTC

    There are loads of ways you can do so, but exactly what the best solution is depends on what you hope to achieve.

    There are HTTP servers that can be installed on phones. Then you can access the web server running on your phone from a web browser on your computer. But if what you hope to achieve is a way of remote-controlling Snapchat, it won't help because each app on your phone runs in its own little jail cell.

    Basically sending a message from your computer to your phone is easy. It just requires an app on your phone that's listening for messages. But what that app is able to do when it receives a message might be pretty limited.

      Remote controlling Snapchat is more similar to something that I’d want to do. But I understand that wouldn’t be possible, but my thinking is that if someone sends or reads a Snapchat, wouldn’t there exist data going into the phone through the network. And that data should be able to be read on a separate device (my computer). Another example, if I load a webpage from my phone, would my laptop be able to pick up on it and know that I loaded a webpage?
Re: Can I communicate with my phone from my computer?
by tybalt89 (Monsignor) on Dec 10, 2019 at 21:05 UTC

    Try this (it worked for me)

    Send a txt message from your phone to your computer, it should show up as an email. Replying to this email should send a txt message to your phone. Now your have the address of your phone to send email messages to.

    Most cell providers have a "txt to email" gateway.

    UPDATE: Send the txt from your phone to your computers email address.

      I’m thinking more sending raw data instead of through email. For example, would it be possible to send an HTML webpage to my phone if both devices are not connected to any WiFi network? Sorry, I know it’s kind of broad questions, I’m not sure exactly the words for what I want to do. But I’ve been looking up networks, and keywords such as TCP UDP, packets.. playing with commands in the terminal like nc and netstat
Re: Can I communicate with my phone from my computer?
by tobyink (Canon) on Dec 11, 2019 at 10:18 UTC

    Not really relevant to this site, but kind of relevant to this thread, I actually do the opposite. Via a combination of HTTP Shortcuts for Android, Apache, and a bunch of PHP and shell scripts, I have icons on my phone's home screen to change the volume of my laptop up and down by 10%, toggle mute, and pause YouTube (though YouTube needs to be in the active browser tab for it to work).

Re: Can I communicate with my phone from my computer?
by bliako (Abbot) on Dec 11, 2019 at 09:24 UTC

    I have a cool idea for you but let's see if these can help you first:

    if you are on the same network, use nmap or friends to discover neighbouring devices. See https://itsfoss.com/how-to-find-what-devices-are-connected-to-network-in-ubuntu which is for linux but nmap can easily be installed on OSX, e.g. via macports or brew or compile from sources.

    The following link explains how to associate two apple gadgets in a "network"

    https://www.engadget.com/2009/09/25/mac-101-create-a-wireless-network-between-mac-and-iphone

    Once you know the IP address using the first method you can telnet/ssh to it, there are apps for this and you need to install an ssh server/client on the other device. You can ftp to it and transfer data to/from it.

    Sidenote: I recently had to buy my first <euphemism>smart</euphemism>-phone running Android. And my first port of call was https://f-droid.org/ where lots of open-source apps exist! I love every bit of F-DROID.ORG and I would suggest using something similar (unlikely it exists) for the iPhone. If it does, you will be somehow protected from spyware and bloatware apps you usually find in apple's or google's app repositories. Re: app XXX requires access to body sensors

    Finally, here is my idea: create an app on your iPhone which will be listening to a port for your commands (if that's too hard for you, make it monitor a local folder - if allowed by ios - for files with commands which you will upload via ftp or create via ssh from the other computer).

    Now you have communicated your commands to your app, from your computer to your iPhone.

    Find out (if at all possible) how your app can write on the fly a shortcut and launch it (or just launch any shortcut uploaded to it: this is the ULTIMATE SECURITY RISK - be warned !!!). Because I have a suspicion that this can't be done, I will suggest this: make your app talk to Siri and ask that *&$^&*^% Siri to launch the Shortcut. If that's allowed then you have only one option left: dump your phone in the toilet pronto. Siri, please reveal all my personal data and browsing history to P.O. Box 1984

    And guess what? According to this guide by fellow Anonymous Monk: How to write apps for macOS/OSX in Perl!, Perl is already installed in iPhones and you can use it to run things like your command listener via applescript, via Workflows!!!!

    bw, bliako

Re: Can I communicate with my phone from my computer?
by marto (Cardinal) on Dec 10, 2019 at 21:19 UTC

    Can you elaborate on what it is you want to achieve?

      I would like to see what kinds of data I can get and send to another device. If my computer and phone are connected to the same WiFi network, how can i find information about my phone, for example what webpages I am using on my phone

        To do that, you would need to install an app on your phone which can listen to requests for information from your computer. And you would need to grant that app permission to view your browsing history. (Like how apps request permission to access your location data.) The bad news is, as far as I can tell, iOS doesn't even have a way for apps to request permission to view the browsing history.

        If you want to be able to, say, keep a log of your phone's browsing history, a better option might be to install an HTTP proxy on your computer, and configure the browser on your phone to route all requests via that proxy. Given how much of the web uses HTTPS now, this is probably of limited value though.

        If your iPhone is stock (not jail broken) I think your options are limited, the Apple walled garden business model and all that. I know that people have written scripts to access iPhone data from the iTunes backups (example sms-backups-iphone.pl). You can get Open_Sound_Control apps for the iOS, cpan has some OSC modules you could use if you were interested in that sort of thing.

      A reply falls below the community's threshold of quality. You may see it by logging in.