Using VBS to send short message

Time:2019-11-14

Just look at the title. I’ve heard that you can use PHP to send text messages (Feixin), and you’ve also used pyfederation implemented by Python to send text messages (Feixin). I’ve also seen the corresponding PHP and python source code. It’s quite complicated to implement. Can we use VBS to implement it?

After seeing the code, I think Niubi even uses the interface on 10086.cn (mobile official website). Has the official of Feixin announced the interface? If not, is the interface discovered by the author of the code? That’s too powerful! Google for a while to find out, oh, not, but WAP Feixin. People like me, who lived in the stone age, still use the cell phones that were produced in 2005 and can only make phone calls and send text messages. Of course, they didn’t know the existence of WAP Feixin. I don’t even send messages now, let alone Feixin. I don’t remember when I last logged in to Feixin.

Copy codeThe code is as follows:
M = “xxxyyyyzzzzz” ‘mobile number
Pass = “12345678” login password
MSG = “Hello world” ‘Feixin content
Const online = 1 ‘Online
Const busy = 2 ‘busy
Const away = 3 ‘leave
Const hidden = 4 ‘stealth
Dim http
Set http = CreateObject(“Msxml2.XMLHTTP”)
http.open “POST”, “http://f.10086.cn/im/login/inputpasssubmit1.action”, False
http.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”
Http. Send “m =” & M & “& pass =” & pass & “& LoginStatus =” & hidden ‘stealth login
wml = http.responseText
If instr (WML, “password input error”) then
Wscript. Echo “sorry, the password is wrong, please re-enter!”
Wscript. Quit ‘login failed, exit program
End If
http.open “POST”, “http://f.10086.cn/im/user/sendMsgToMyselfs.action”, False
http.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”
Http. Send “MSG =” & MSG ‘text your phone
wml = http.responseText
If instr (WML, “sent successfully”) then wscript.echo “sent successfully”
http.open “GET”, “http://f.10086.cn/im/index/logoutsubmit.action”, False
Http. Send ‘log out

Here’s just an example. As for how to send SMS and Feixin to others, think about it. Originally, I wanted to write a vbsfection like pyfestival, but it didn’t make sense to think about it. In this way, it’s better to install a Feixin PC client directly, so the students who like to toss can continue.
The above program can be easily rewritten into other languages, such as C, C + +, C, Java, JavaScript, python, Perl, ruby, Lua, PHP You can do a lot of interesting things with this interface, can’t you?

VBS SMS sending class (vbsfetion)

I originally wanted to rewrite the VBS program in yesterday’s sending SMS with VBS into PHP, but in order not to build wheels repeatedly, I googled it in advance and found that it has been implemented. For details, please refer to the release of PHP Feixin sending class v1.2. Well, now that someone has encapsulated it as a PHP class, I’ll encapsulate a VBS class.

Copy codeThe code is as follows:
Class VBSFetion
Private [$mobile], [$password], http
‘Author: Demon
‘Website: http://demon.tw
‘Date: 2011/6/11
‘initialize event
Private Sub Class_Initialize
Set http = CreateObject(“Msxml2.XMLHTTP”)
End Sub
‘end event
Private Sub Class_Terminate
Call Logout()
Set http = Nothing
End Sub
‘initialize function
‘mobile number
‘password login password
Public Function Init(mobile, password)
[$mobile] = mobile
[$password] = password
str = Login()
If instr (STR, “wrong password”) then
Init = False
Else
Init = True
End If
End Function
‘Send a letter
‘mobile number
‘message send content
Public Function SendMsg(mobile, message)
If message = “” Then Exit Function
If mobile = [$mobile] Then
Send = ToMyself(message)
Else
uid = GetUid(mobile)
If uid <> -1 Then Send = ToUid(uid, message, False)
End If
End Function
‘send SMS
‘mobile number
‘message send content
Public Function SendShortMsg(mobile, message)
If message = “” Then Exit Function
If mobile = [$mobile] Then
Send = ToMyself(message)
Else
uid = GetUid(mobile)
If uid <> -1 Then Send = ToUid(uid, message, True)
End If
End Function
‘landing
Private Function Login()
url = “/im/login/inputpasssubmit1.action”
data = “m=” & [$mobile] & “&pass=” & [$password] & “&loginstatus=4”
Login = Post(url, data)
End Function
‘logout
Private Function Logout()
url = “/im/index/logoutsubmit.action”
Logout = Post(url, “”)
End Function
‘Send a letter to yourself
Private Function ToMyself(message)
url = “/im/user/sendMsgToMyselfs.action”
message = “msg=” & message
ToMyself = Post(url, message)
End Function
‘Send a letter (SMS) to a friend
‘UID Feixin ID
‘message content
‘isshot true is SMS, false is Feixin
Private Function ToUid(uid, message, isshort)
If isshort Then
url = “/im/chat/sendShortMsg.action?touserid=” & uid
data = “msg=” & message
Else
url = “/im/chat/sendMsg.action?touserid=” & uid
data = “msg=” & message
End If
ToUid = Post(url, data)
End Function
‘get Feixin ID
‘mobile number
Private Function GetUid(mobile)
url = “/im/index/searchOtherInfoList.action”
data = “searchText=” & mobile
str = Post(url, data)
Set re = New RegExp
re.Pattern = “/toinputMsg\.action\?touserid=(\d+)”
If re.Test(str) Then
Set ms = re.Execute(str)
GetUid = ms.Item(0).Submatches(0)
Else
GetUid = -1
End If
End Function
‘send HTTP post request
Private Function Post(url, data)
url = “http://f.10086.cn” & url
http.open “POST”, url, False
http.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”
http.send data
Post = http.responseText
End Function
End Class
Sample program:
‘initial object
Set fetion = New VBSFetion
‘landing in Feixin
If fetion.Init(“11122223333”, “123456”) Then
‘Send a letter
fetion.SendMsg “44455556666”, “Hello world”
‘send SMS
fetion.SendShortMsg “77788889999”, “Hello world”
End If

Source: http://demon.tw/my-work/vbsfetion.html