Error on checking balance via USSD - putty

I've been trying to check my balance from by 3g modem via AT commands and seem to be stuck.
The device infomation is as follows:
Manufacturer: QUALCOMM INCORPORATED
Model: M6281
Revision: SSD_M6281A-0.0.1 1 [Oct 02 2008 07:00:00]
The modem has USSD capability (advertised and also present in the factory installed dashboard).
I am connecting via putty to COM4 serial port which is my modems application port. All AT commands are working fine but I am getting an error on issuing the following via putty:
AT+CUSD=1,"*111#",15
This returns a simple "ERROR". *111# is my carrier's balance check code. I suspect that there is a formatting error somewhere but I can't figure out where.
Note: If I issue a blank ussd command:
AT+CUSD=1,"",15
then I get an OK (although I later get a response +CME ERROR: retry operation) ... If I write anything within the quotation marks however, it returns an "ERROR".

Ok, I finally found the way to fix this. Apparently there was a problem in the encoding. Here is what I did:
AT+CSCS="GSM" // change character set to GSM
AT+CUSD=1,"*111#",15 // Issued balance check ussd code
It now works fine.
The default encoding was UCS2, I'd appreciate if someone can share how to convert ussd codes to UCS2 encoding in putty.

Have you tried issuing request by AT+CUSD=1,"*111#" ? (without last parameter)
AT cmmands sometimes differ due to manufacturer implementation.

Related

Windows 10 SNMP service not responding

I'm trying to get my head around SNMP for a project I'm working on. After I failed miserably getting it to work in my company's network, I set up a simple 3-device network to test things on, consisting of two Windows 10 PCs and a manageable switch between them.
I installed the optional feature "SNMP" on both PCs, made sure the service is running correctly and configured both services to accept SNMP queries from each other. I made sure to open up UDP port 161 in both PCs firewalls. Then I got the Net-SNMP binaries in order to use SNMPGET and SNMPWALK. As an alternative, I set up the SNMP extension for PHP through xampp (since I want to use PHP in my project once I get SNMP to work). Finally, I installed wireshark to monitor what exactly is going on and this is what I found:
When I try SNMPGET or SNMPWALK either through cmd or as a PHP command, I always get a timeout message. Wireshark is showing the get-next-request leaving one PC and arriving correctly on the other, so the network connection itself is working fine. But the receiving PC never sends a response. As I said, I'm pretty new to SNMP and I'm at a loss as to why this is happening. As I understand it, the optional feature for Windows 10 comes with its own SNMP agent, correct? If so, what could cause it to simply ignore an incoming request from a valid source IP?
The funny thing is that this even happens when I try to send an SNMP query to 127.0.0.1. I have no idea what I'm doing wrong...
Thanks to the comment of Lex Li, I was able to finally figure out which step I made a mistake with:
When setting up the SNMP service, under the security tab, I had to add 'public' as an accepted community name (with READ-ONLY rights). I figured since 'public' is sort of the standard read-only community, it would be accepted by default, which apparently it is not.
Alternatively, I guess I could have added my own communtiy name, but I didn't try that since I only want to read some values through SNMP anyways and read-only access is all I need for that.
Thank you very much Lex Li, I'm off to continue my project now!

How do I set up and test Gammu RunOnFailure script

Gammu documentation related to gammu-smsdrc config says
RunOnFailure New in version 1.28.93.
Executes a program on failure.
This can be used to proactively react on some failures or to
interactively detect failure of sending message.
The program will receive optional parameter, which can currently be
either INIT (meaning failure during phone initialization)
I have added the following to my /etc/gammu-smsdrc config file:
RunOnFailure = /home/pi/fail.sh
How do I access and use the parameter INIT? I want to setup SMS notificaion on failure of phone initialization.
I figured it out.
There are two scenarios of failure.
Problem with sending a message. In which case $1 (bash) will be an integer which is the row id of message in MySql database. I am not sure what its going to be if you have configured Gammu in file backend mode.
Gammu cant access or connect to the phone or GSM modem. In this case $1 = INIT.
I am using a PHP script to RunOnFailure so it is going to be $argv[1] for me.

Windivert fails in Win10 - Solution to TCP 3handshake - Evade windows RST packets

I had a project which used windivert to work as a router in my network, and it worked fine but now is dead with the same code. Previous versions which worked succesfully now dont work. I always get the same Windivert error which is 997 (Overlapped I/O operation is in progress).
For example when I use WindivertOpen I get the error, when I restart the computer to reset the windivert driver I dont get the error 997 in WindivertOpen but I get it in WindivertSend or WinDivertSendEx and after use them I again get the error in WindivertOpen. These functions worked fine for me months ago and my router worked as I expected, but now I am done with these errors, there is nothing I can do, maybe this is caused by a windows security update.
I need to know how to reset the driver without restart the computer and to know what I can do to face this problem. I used windivert to block windows TCP RST packets to my router fordwards, windows does this when there is not sockets associated with the ports that you are fordwarding, what can I do to block this packets without windivert or with a working way of windivert?
The 997 error is ERROR_IO_PENDING, but the error code is meaningless unless WinDivertOpen returns INVALID_HANDLE_VALUE. Otherwise the call will have completed successfully.
Presumably you have upgraded to WinDivert 1.4 from a previous version. Simply replacing the binary files (dll/sys) won't work -- you must instead recompile your program against the new API.

Scapy Windows sr1() not being answered

I'm using the Scapy library for Python 2.6 on Windows 7 in order to see if I can spoof my IP address (for non-malicious purposes, I'm curious how it works).
When I use the sr1() function, it sends the packet, but it gets nothing in return. I have to interrupt it manually using CTRL+C in order for it to stop receiving packets that are not an answer.
I've tried to use both Python-Scapy or the like-How can I create an HTTP GET request at the packet level and Scapy: no reply on raw ICMP packet, with no luck.
I have tried tracking it in Wireshark, but nothing showed up.
I know Scapy is not made for Windows, so that could be the issue. If so, I can get a Linux environment instead.
NOTE: Note that I am running this through the console version of Scapy, but I found the exact same results running it through Python scripts.
IP(dst="www.google.com")/TCP(dport=80,flags="S")
This TCP packet's sport will automatically set to be 20 (www-data) in Scapy.
And what is worse, www.google.com does not reply from the sport=20 (www-data)
try
IP(dst="www.google.com")/TCP(sport=65000,dport=80,flags="S")

How to send SMS with GSM Click Modem?

I can finally make a phone call, receive, and answer it. But if I try to send an SMS I receive CMS ERROR: 500. The GSM modem I am using is Telit GL865-Quad module. Since the Call function is working, what's preventing the SMS to work? please enlightenment me. The Sim Card works fine on my phone to rule out some of the problems. I am using a hyperterminal to type the commands at 19200 speed. This is the user guide with commands for your own convenience.
To send an SMS:
AT+CMGF=1 // Select Text Mode
OK
AT+CMGW=”+xxxxxxxxxxxx” // my number
> Hi
>
+CMGW: 8
OK
AT+CMSS=8
Error: +CMS ERROR: 500
Any ideas to what the error means, since its unknown error? What are some commands to type out to pinpoint the problem?
I would appreciate your help, thanks!
+CMS ERROR: 500 is unfortunately a very generic error message.
I have a few suspicions which may solve your problem:
1) Timing problem
Writing an SMS to the SIM card will take a "significant" amount of time. Between writing the SMS to SIM and sending the SMS wait a couple of seconds.
2) Check that the SMS really did get written to SIM
Using the CMGR command you can verify if the SMS is written to SIM and it's current status.
For example:
AT+CMGR=8
Alternatives:
You can always send an SMS directly without storing on the SIM. This is generally a more favored approach for multiple reasons including SMS sending is quicker and SIM lifetime is extended due to reduced read/writes.
This can be achieved by using:
AT+CMGS=<destination address>
>Hi
You can additionally use the CNMI command to prevent incoming messages being stored on the SIM and being output directly to the console/telnet connection.
Replying on a 7 year old thread - sorry.
Make sure you terminate your message "Hello" with ASCII SUB (0x1A)

Resources