how to get balance by USSD commands? - modem

I have tired to search how to send USSD command on Google.
I want to check may balance from operator.
All of the samples I have seen use commands like this:
"AT+CUSD=1,\"*140*1#\"\r\n";
It seems to be correct. I am using something like this that I think works. I have a D-Link GSM modem, and when I send this command using it, it makes some noise on my speaker, which I believe tells me something happened.
my modem have it's own windows application when i disconnected modem by my own application,i check it by modem's application and in USSD tab i can found the result of my commands that i sent by myself application.
then that command works fine but i 'm confuse what is happens when i sent my command it return me "OK" and do not return operator answer and how my modem's application can read that answer????????
i test these commands but can not get result and my modem just return somethings like this:
"AT+CUSD=1,\"*140*1#\"\r\n\OK\r\n" only.
1) "AT+CUSD=1,\"*140*1#\",15\r\n"
2) "AT+CUSD=1,\"*140*1#\",1\r\n"
3) "AT+CUSD=1,\"*140*1#\",15\r"
4) "AT+CUSD=1,\"*140*1#\",1\r"
5) "AT+CUSD=1,\"*140*1#\""
i think reading command's result maybe has difference command or i should set some config on my modem .
it is very interesting for me that my modem do not return error to me and always return OK.

You need to set the Message format to AT+CMGF=0, before sending your USSD Command. This is PDU Mode (http://www.smartposition.nl/resources/sms_pdu.html). I was stumped using AT+CMGF=1, which is Text mode, before I decided to try AT+CMGF=0.
Worked like Magic.
So:
Set Message Format to PDU (AT+CMGF=0)
Execute Your USSD Command (AT+CUSD=1,*544*2*3#,15) - example message
Read response from the Port.
I am assuming that you know already how to form your AT Commands and Read the response from the Port.

I found that my modem use more than one port and i should connect at the first port to send my command and listen to another port to get the USSD command's result

Try This using Hyperterm Serial Monitor Application ( https://www.hilgraeve.com/hyperterminal-trial/ )
First Convert Modem to PDU Mode :
AT+CMGF=0
Second USSD Code Send :
AT+CUSD=1,"#132#",15
( Use your Country Carrier Codes )
Finally Read Output from Terminal :)

i just use this "AT+CUSD=1,'*120#',15" in my country the USSD code is *120# but remember if you are using it withing a code you must add crlf character to the end hope this help

Related

Building Wireshark LDAP filter for future scripting

all
On our environment we have several servers still using ldap for authentication and I need to filter ldap requests for 8 hours to have an overview on how many different accounts we may have exposed.
The issue is I cannot create captures that are too large. (Just for an example, using a filter to ldap port and marking the flags of a TCP request I barely can capture 3 minutes before my capture is hitting 100MB).
I wonder if there is a way to build a capture filter that would look for a HEX on the DATA part of the packet.
Does anyone have any clue on how I would be able to do that?
Currently I am using a capture filter like:
port 389 && tcp[13] == 24
and a display filter like:
ldap.bindRequest_element && ldap.messageID==1
Another issue is that doing this I couldn't come up with a script that would strip the username so I could inform all possibly compromised users to change their PWDs.
Thanks in advance
I found a way to do this.
Just for people that are still curious or would need something similar I used the following:
port 389 && tcp[((tcp[12:1] & 0xf0) >> 2) + 2:2] = 0x0201 && tcp[((tcp[12:1] & 0xf0) >> 2) + 4:1] = 0x01
This check the data part of the packet and since some of the bytes are always in the same position and are all the same for a ldap bind request with message id 1 I used that to build the filter.
Cheers.

ip address updation in openflow

I am trying to modify the destination address for an incoming ping request at the switch using a POX controller. I use packet.next to modify the destination address. Once this address is modified I create a new packet with the incoming source IP and the new destination IP. But my pings aren't getting through. I also make sure that the nw destination of the message is modified before it is sent to the switch.
It will be really helpful if someone can help me solve this issue.
I'm using the l3_learning.py sample program present in Mininet.
I've added this condition in the handle_PacketIn function to the ifinstance(packet.next,arp).
My code
: : if str(packet.src)==str("00:00:00:00:00:19") and (inport)==19: packet.src = EthAddr("00:00:00:00:00:22") inport = 22 if str(packet.dst)==str("00:00:00:00:00:19") and inport==19: a1.protosrc = IPAddr("10.0.0.6") a1.hwsrc = EthAddr("00:00:00:00:00:22")
I then send an ARP packet.
I have changed the nw_dst using ofp.match() –
I figured out what I was doing wrong. Instead of programming flows I was directly trying to modify the packets to redirect to the hosts. That was why I was unable to get a ping response.

OpenSSL: Specify packet size of application data

When I do something like this, apps/openssl s_client -connect 10.102.113.3:443 -ssl3, client-server communication is created using openSSL.
Now, I want to send application data from the client to the server. For example, after doing apps/openssl s_client -connect 10.30.24.45:443 -ssl3, I get something like this:
...certificate and session details...
---
GET /path/to/file
The GET /path/to/file all goes in one SSL record. I want to send it in multiple records.
I assume I have to edit apps/s_client.c, and find the place where the SSL_write or similar happens.
How do I go about something like that?
For a properly designed application the TCP packet sizes and SSL frame sizes should not matter. But there are badly designed applications out there which expect to get like the HTTP request inside a single read, which often means that it must be inside the same SSL frame. If you want to run tests against applications to check for this kind of behavior you either have to patch your s_client application or you might use something else, like
#!/usr/bin/perl
use strict;
use IO::Socket::SSL;
my $sock = IO::Socket::SSL->new('www.example.com:443') or die "$!,$SSL_ERROR";
print $sock "GE";
print $sock "T / HT";
print $sock "TP/1.0\r\n\r\n";
This will send the HTTP request header within 3 SSL frames (which might still get put together into the same TCP packet). Since on lots of SSL stacks (like OpenSSL) one SSL_read reads only a single SSL frame this will result in 3 reads necessary to read the full HTTP request.
Okay, I figured out that I needed to change the number of bytes I'm writing using the SSL_write.
This is a code snippet, starting at line 1662 of s_client.c:
if (!ssl_pending && FD_ISSET(SSL_get_fd(con),&writefds))
{
k=SSL_write(con,&(cbuf[cbuf_off]), (unsigned int)cbuf_len);
.......
}
To make the application data be sent in multiple records instead of just the one, change the last parameter in the SSL_write.
For example, do this:
if (!ssl_pending && FD_ISSET(SSL_get_fd(con),&writefds))
{
k=SSL_write(con,&(cbuf[cbuf_off]), 1);
.......
}
This will result in something like this:
Notice the multiple records for Application Data instead of just the one.

Cannot send USSD GSM Modem

I am working with SMS Application using VB.NET and Serial Ports using GSM modem. I checked the following threads on this site but it cannot answer my problem. Here's what I've done
AT+CUSD?
+CUSD: 1
OK
AT+CUSD=?
+CUSD: (0-2)
OK
AT+CUSD=1,"*102#",15
ERROR
I also changed the message format to PDU and Text but the result stays the same. It always show Error.
Please help.
First try this :
AT+CSCS?
mine is like this
+CSCS: "PCCP437"
OK
To know what kind of encoding is used.
And to know the supported encoding by your modem do this :
AT+CSCS=?
+CSCS: ("UCS2","GSM","PCCP437","PCDN","IRA","8859-1","HEX","UTF-8")
OK
It will return valid values for encoding.
Set it like this :
AT+CSCS="UCS2"
OK
Now your command will be like this using UCS-2 encoding :
AT+CUSD=1,"002A0031003000320023",15
Tell what you find?

Command Status 0x00000011 with submit_multi for SMPP integration

Hi am integrating with Sybase Mobile 365 Services and I have gotten submit_sm and deliver_sm to work fine. I am trying to get submit_multi to work, but no matter what I try I get back a Command Status = 11. Does anyone have any thoughts as to what that command status means? Why I would get that? I have tried different service types and everything else I can think of... with no success.
Thanks,
Stephen
Command Status = 11 (ESME_RINVDSTADR) means "Invalid destination address".
This mean that probably the the dest_address field in your submit_multi request is wrong.
The dest_address field for submit_multi should be a list of destination address structures as defined in SMPP 3.4 Specification - chapter 4.5.1.1.
The number of destination addresses in the list is set in the number_of_dests field.
Additionally, you could also check that the dest_addr_ton (Type of Number) and dest_addr_npi (Numbering Plan Indicator) are correct for each destination address. For more details about this check out this link.