nullwriter / crypto-fantasy

Realtime crypto fantasy trading game played through a bot in Whatsapp.
1 stars 0 forks source link

Confused about install + setup. #1

Open ydennisy opened 6 years ago

ydennisy commented 6 years ago

Hello, Is the process first to get the app running using docker-compose and then register on yowsup, make changes to the creds file and run the second docker command? Is the app accessible at any URL? Thanks in advance. Dennis

nullwriter commented 6 years ago

So yes, as mentioned you first run docker-compose command. You do docker exec -it <container_id> bash to go inside command line of the docker image, and then you followyowsup's registration process which basically is the same thing that happens when you register a new phone to whatsapp. After that, you add you credentials and continue with cd app and python3 run.py or run-cli.py

ydennisy commented 6 years ago

Thanks I am getting this error when running the final step - python3 run.py

crypto-fantasy ➤ docker run -i -t 0192d551d8f2 /bin/bash                                                                     git:master*
root@469375417cd4:/code# cd app
root@469375417cd4:/code/app# python3 run.py
Traceback (most recent call last):
  File "run.py", line 7, in <module>
    from layer import EchoLayer
  File "/code/app/layer.py", line 1, in <module>
    from yowsup.layers.interface import YowInterfaceLayer, ProtocolEntityCallback
  File "/usr/local/lib/python3.6/site-packages/yowsup2-2.5.2-py3.6.egg/yowsup/layers/interface/__init__.py", line 1, in <module>
    from .interface import YowInterfaceLayer, ProtocolEntityCallback
  File "/usr/local/lib/python3.6/site-packages/yowsup2-2.5.2-py3.6.egg/yowsup/layers/interface/interface.py", line 5, in <module>
    from yowsup.layers.protocol_media.mediauploader import MediaUploader
  File "/usr/local/lib/python3.6/site-packages/yowsup2-2.5.2-py3.6.egg/yowsup/layers/protocol_media/mediauploader.py", line 10, in <module>
    from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'
root@469375417cd4:/code/app#
ydennisy commented 6 years ago

Hello @nullwriter I have managed to get this going :)

Now the app is running and I have the below output in console:

app ➤ sudo python3 run.py                                                                                                    
>>>>>> Starting at 07-04-2018 11:25:50
>>>>>> Loop start
Will try to reboot in 10s
>>>>>> Loop start

I have registered my number with whatsapp too, so now how do I interact with the crypto bot?

Also have you seen the issues with yowsup its it maybe being blocked by Whatsapp: https://github.com/tgalal/yowsup/issues/2422 https://github.com/tgalal/yowsup/issues/2462

Any ideas on how to best go around this, maybe a new UI to this app is needed - some simple REST interface to the BOT?

nullwriter commented 6 years ago

You interact by opening a conversation in Whatsapp with the number of the bot. Make sure to add it to your contact list first.

I have seen those issues and it's something that happens since Whatsapp does not allow 3rd party applications to work with them. But I've found that a sweet spot to make it pass as a normal user is giving it a delay which is included in the code here (after 3 different numbers banned :) ). When the bot replies too quickly, it becomes flagged and banned.

ydennisy commented 6 years ago

@nullwriter when I was testing on my local with my number all was fine.

I bought a new number and loaded into Google Cloud and the number was blocked right after the first reply to HELP command :(

When you say the delay in the code is the the 10 sec loop in run.py?

ydennisy commented 6 years ago

@nullwriter I have looked more in the code and found sleep() in layer.py - this now seems the place where you are adding the delay to make it seem a human response? Let me know if this is it I may try and increase it.

nullwriter commented 6 years ago

Hey @ydennisy, sorry for the delay, I've been away but back now.

Been doing some research and it seems Whatsapp has upped their game in detecting bots. From reading several issues in Yowsup, I've found what seems to be the key to surpass their bot tests. Below is a copy paste of a comment 7 days ago where the guy tested several methods and came to a conclusion:

1 - If you register a number directly via yowsup, the number is banned after one message (tested with 3 numbers)

2 - If you register a phone in your android, chat a bit, and then, after 12 - 14h you close whatsapp client and register the number on yowsup, it works.

3 - ONLY ONE TEST: 72h after registration on Android, and created profile via WApp Web, it fully worked for two weeks until I sent a friend one link that was banned in FB (and I didn't know).

nullwriter commented 6 years ago

In the following days I'll be testing this and updating, if needed, the code.

Nacho223 commented 6 years ago

Hello @nullwriter ! I'm the guy that wrote your copypaste. Further tests made:

It's important to register having modified the env_android.py (and recompiled) with this data:

_MD5_CLASSES = "YlajJPPGUUP1Ptcic2XKNA=="

_VERSION = "2.18.105"

Yesterday I burned three phone numbers at 6-10 messages, and with this method I've been able to send 85 this morning (and received answer from myself).

The key of all this mess is that yowsup get fixed so that it can send messages with -E android. I don't know python nor the API; and I code in C#, so I can't help. But I'm doing my best to deduce as a tester what the problem is; and I think it's this.

Nacho223 commented 6 years ago

This is my original comment:

https://github.com/tgalal/yowsup/issues/2482#issuecomment-381967382