Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic
1 | 2 | 3
richms
28168 posts

Uber Geek

Trusted
Lifetime subscriber

  #1260849 17-Mar-2015 10:50
Send private message

Look at the source of the page that has the username and password fields and the URL it submits to, do a curl request to that URL with those fields filled out and it will populate the cookies that let you do other things.

Then do a curl to the page that displays the SMS's and you will be able to pull them out with a bit of effort. There are many many tutorials on using curl to webscrape things like this.




Richard rich.ms



ianboag
103 posts

Master Geek

Trusted

  #1261064 17-Mar-2015 13:58
Send private message

Richard. Would you like to create this for money? I can supply the hotspot ...

ianboag
103 posts

Master Geek

Trusted

  #1261066 17-Mar-2015 13:59
Send private message

Oops. I think I meant Malcolm :-)



richms
28168 posts

Uber Geek

Trusted
Lifetime subscriber

  #1261085 17-Mar-2015 14:17
Send private message

Not really at the moment. I have too much on to get into the headspace to be able to tackle something like that. Dealing with renovations and tradespeople really take it out of you.




Richard rich.ms

Killerkiwi2005
374 posts

Ultimate Geek

Trusted

  #1261134 17-Mar-2015 15:29
Send private message

since you have a rpi I'd use python3, a bit easier to learn then curl

import urllib
import http.cookiejar
cookieJar = http.cookiejar.MozillaCookieJar("jar.cookies")
url = "http://127.0.0.1"

encodedPost = urllib.parse.urlencode({'email': email, 'password': password}).encode('utf-8')
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookieJar))
request = urllib.request.Request(url, encodedPost, headers)
response = opener.open(request)
html = response.read().decode()

ianboag
103 posts

Master Geek

Trusted

  #1261135 17-Mar-2015 15:32
Send private message

Unfortunately my Pi runs python 2.7 ... pywws won't work with version 3

I'm not uncomfortable with curl .... 

Killerkiwi2005
374 posts

Ultimate Geek

Trusted

  #1261155 17-Mar-2015 16:05
Send private message

ianboag: Unfortunately my Pi runs python 2.7 ... pywws won't work with version 3

I'm not uncomfortable with curl .... 


The name spaces are slightly different but the rest is the same

 
 
 

Cloud spending continues to surge globally, but most organisations haven’t made the changes necessary to maximise the value and cost-efficiency benefits of their cloud investments. Download the whitepaper From Overspend to Advantage now.
Killerkiwi2005
374 posts

Ultimate Geek

Trusted

  #1261162 17-Mar-2015 16:15
Send private message

python2 would work as well namespaces are just slightly different

patrickdavey

7 posts

Wannabe Geek


  #1285948 17-Apr-2015 07:04
Send private message

Hi there,

Firstly - should have checked back here before.  What Richard said above:

It was a case of a setting on the hotspot and plugging it in, then an ifup command on its interface name

Was exactly what I needed to do to get the pi working.  The only issue I am currently having is that it seems to be somewhat flakey in what order the pi is turned on, and the usb dongle connected... but I'll get that worked out soon enough I hope!  Anyway, the trick is that the usb dongle creates a gateway (for me, at 192.168.9.1) and you can then just configure your network/interfaces to bring up ethernet and away you go.

It is _also_ possible to read SMS's off the modem stick.  Now, the only way I have worked out how to do this (and it's an evil kludge) is to basically spin up a virtual browser and click around on the web interface which is presented at the 192.168.9.1 address.  It's evil, but it works.  I imagine there must be a nicer way to pull the data straight off the USB stick, but that low-level stuff is a little beyond me, and I just wanted to get the (damn thing!) working.  I will actually try cURL this weekend, no cookies required I suspect as there was no login required.  If it all rails, my ruby script will come to the rescue ;)

Anyway, success!  very happy to be able to send data off the pi, and SMS it.

Thanks for all the help, and Richard, I wish I'd properly read your comment before.  There's so much info out there (like the SAKIS script etc.) which is just totally irrelevant these days.

Patrick


ianboag
103 posts

Master Geek

Trusted

  #1286933 18-Apr-2015 19:02
Send private message

You've got me!  

I have moved on from a hotspot to a T-stick driven with wvdial. Works fine but you have me intrigued. From what you just wrote it sounds like you are using a (because it's a router) rather than a stick (which AFAICT is just a modem).   Sooo . could you expand on what ifup does here? And a bit more about your "pseudo browser" ....

One of the problems I couldn't solve with the hotspot was that if the power was turned off long enough for the battery to go flat, then it needed a (physical) button push to restart which was a bit hard if it is up a 10m pole.

Cheers IB

richms
28168 posts

Uber Geek

Trusted
Lifetime subscriber

  #1286935 18-Apr-2015 19:13
Send private message

ifup enables an ethernet interface.

Linux seems to wisely not just enable any old ethernet USB device that is plugged into the machine untill root says so, where as windows you plug it in and suddenly its sending all its traffic via it.




Richard rich.ms

patrickdavey

7 posts

Wannabe Geek


  #1287092 19-Apr-2015 09:11
Send private message

Hi Ian,

As Richard said, ifup brings the network interface up.  However, all I did was add this to the bottom of my /etc/network/interfaces

auto usb0
iface usb0 inet dhcp

then when I do an ifconfig it'll look like this:

usb0      Link encap:Ethernet  HWaddr 02:0c:e7:0b:01:02  
          inet addr:192.168.9.136  Bcast:192.168.9.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54042 errors:0 dropped:7 overruns:0 frame:0
          TX packets:53840 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4938608 (4.7 MiB)  TX bytes:4501950 (4.2 MiB)

Note, it has been flakey dependent on whether the modem was turned on first or not.. but it did work.  I will get to the bottom of that, but haven't managed it yet.

As for the browser stuff, again, it may be possible to use straight curl, but, in the meantime, I am a Ruby programmer by trade, and one of the tools I use is called watir (https://github.com/watir/watir/ )  So I installed iceweasel (Firefox).. and then I can use a ruby script to automate the clicking around the pages.  It's by no means finished yet, but I have tested sending a text and seeing it appear on the webpage... now it's just a case of wrapping the functionality so that, ultimately, I can just call something like raspberrysms get_latest_message and it'll just give me the latest SMS details.  Again, haven't even started it yet, but at least all the pieces are working now.

That said, if you managed to get wvdial working, can you use that to pull the sms's off somehow?  (I really have no clue how that stuff works, and I'm not sure I want to ;)

If and when I get the SMS browsing stuff working I'll post a link, but it will be _very_ specific to my vodafone modem stick setup, so I'm not actually sure how much use it would be.

Best,
Patrick

patrickdavey

7 posts

Wannabe Geek


  #1291777 26-Apr-2015 16:21
Send private message

Thanks again to Richard for suggesting cURL... I had a closer look at it, and indeed, was able to do everything I wanted through cURL.

Anyway, for anyone who's interested, and on the vodafone network, and who has Ruby installed on their pi (or anywhere else).. I have made a start at a gem for talking to the vodafone dongle.  At the moment, you can connect, disconnect and get the status.  I do know how to do the SMS's .. just haven't yet put it together - tomorrows job ;)

If you're interested:  https://github.com/patrickdavey/vodem_sms

patrickdavey

7 posts

Wannabe Geek


  #1293887 29-Apr-2015 21:40
Send private message

Well, I can read SMS's etc, and I have had the modem connecting to the internet, however, at the moment it's DNS settings seems broken, and I'm not quite sure why.  If I do a traceroute to google I get this:

1 192.168.9.1 (192.168.9.1) 0.909 ms 1.599 ms 1.792 ms
2 172.27.74.44 (172.27.74.44) 1141.241 ms 1143.081 ms 1143.172 ms
3 172.27.66.219 (172.27.66.219) 1243.072 ms 1243.110 ms 1243.119 ms
4 172.27.87.69 (172.27.87.69) 1275.568 ms 1275.273 ms 1242.989 ms
5 172.27.87.70 (172.27.87.70) 1275.574 ms 1275.299 ms 1275.616 ms
6 203.109.129.190 (203.109.129.190) 1275.370 ms 1242.945 ms 1242.237 ms
7 203.109.129.189 (203.109.129.189) 1209.486 ms 105.834 ms 105.253 ms
8 203.109.180.225 (203.109.180.225) 105.353 ms 133.821 ms 147.434 ms
9 203.109.180.226 (203.109.180.226) 149.173 ms 147.342 ms 147.348 ms
10 192.168.59.254 (192.168.59.254) 146.812 ms 82.653 ms 126.443 ms
11 * * *

So, it's trying to get out (some of those addresses are vodafone ip's) but it's coming back with 192.168.59.254, which is quite wrong.

If anyone has suggestions I'd love to hear them.  I opened a more full StackOverflow question here: http://raspberrypi.stackexchange.com/questions/30052/network-issues-with-huwaei-usb-3g-modem

ianboag
103 posts

Master Geek

Trusted

  #1323518 12-Jun-2015 16:13
Send private message

Just a bit of an update - in case anyone is interested - on how I have more or less cracked the stick-on-Pi-and-SMS problem ...

I used a Spark ZTE stick - installed wvdial and it all goes fine. Not all that hard even.

For texts, there's gammu - which makes SMS's too simple as well.

Next project is to get a reverse SSH set up on the Pi so I can get a connection to something on the other side of a standard cell modem - for a provider where there is no "inwards" APN.   I have a certified geek coming to do that for me next week. With any luck I'll sort of understand it after he has worked his magic :-)

I could run a reverse VNC the same way too.  That might actually be simpler to set up.  I don't have to have them there all the time as I can just send an SMS to get whatever I want fired up.


1 | 2 | 3
Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.