mrmin123 / kancolle-auto

Kantai Collection (Kancolle) bot/automation tool - DEPERECATED - see kcauto-kai:
https://github.com/mrmin123/kcauto-kai
54 stars 22 forks source link

Warning! BOT detection enhanced on new update #94

Closed n0k0m3 closed 8 years ago

n0k0m3 commented 8 years ago

https://twitter.com/KanColle_STAFF/status/681753432252780545 Overall, I think we're safe since the script act (mostly) human-like. However there are some weird mousemove event that move the mouse to ONE specific position on the screen (App.focus, "Next" click, etc.) that and EASILY be tracked and flagged by the client. (Idk anything about coding and how Sikuli script works though) Hopes someone can fix this @mrmin123 senpai plz notice this post.

Edit: Actually I found that after most click event, there is a mousemove event to the same point on Kancolle client

n0k0m3 commented 8 years ago

expedition.py: self.kc_window.mouseMove(Location(self.kc_window.x + 100, self.kc_window.y + 100)) -> 1 hit

combat.py self.kc_window.mouseMove(Location(self.kc_window.x + 100, self.kc_window.y + 100)) ->7 hits

util.py: kc_window.mouseMove(Location(kc_window.x + 100, kc_window.y + 100)) -> 5 hits

kancolle_auto.py:

kc_window.mouseMove(Location(kc_window.x + 100, kc_window.y + 100))
kc_window.mouseMove(Location(kc_window.x + 120, kc_window.y + 120))

Are these line really neccessary? I know these are the reasons that every time the mouse move to the exact same position everytime. But do we actually need it everytime executing the event?

//Suggestion edit if the code is still needed:

iprand = random.randint(100, 400)

// Again, idk how sikuli script works. Is this the right way to do RNG everytime iprand is called???

wait(iprand)

//And replace "+ 100" and "+ 120" with "+ iprand" //Why (100,400)? since the kancolle windows (100% scale) is 800x480

mrmin123 commented 8 years ago

Thanks for bringing that tweet to my attention!

Those lines exist to either wake up the screen on certain OSs (the 100 to 120 ones), or to reset the mouse so that it doesn't hover over the next item that the script looks for. Both have the possibility of crashing the script if not resolved properly.

It's definitely possible to randomize the mouse reset position, but care has to be taken that it doesn't reset on a position ON the kancolle game area, since it hovering over the next desired item may crash the script. Or designate "safe" areas on the game screen by coords, not image matching, but that may be difficult since different browsers and setups have the game in different positions.

I'd like to think that dmm doesn't track mouse MOVEMENT, but I used to think that about click locations and was proven wrong (I wonder if the person who took apart the game client is still around... I'm not too familiar with flash myself). If they are tracking movement, however, this complicates matters because sikuli decisively does not move like a human (linear movement and acceleration) , and I'm not sure how I'd get address that.

All that said, I won't be able to make any modifications for a day or two as I'm on the road.

n0k0m3 commented 8 years ago

@mrmin123 Ok tks for explaining the code Now I'm working on it (w/o any programming knowledge lol)

Testing: Replace

kc_window.mouseMove(Location(kc_window.x + 100, kc_window.y + 100))

with

kc_window.mouseMove(Location(kc_window.x + 370 + random.randint(0,400), kc_window.y + random.randint(100,400))

in kancolle_auto.py and util.py And replace

self.kc_window.mouseMove(Location(self.kc_window.x + 100, self.kc_window.y + 100))

with

self.kc_window.mouseMove(Location(self.kc_window.x + 370 + random.randint(0,400), self.kc_window.y + random.randint(100,400))

in combat.py and expedition.py (no prob with quest.py so far)

I will test them for around 3 days and then submit pull request

mrmin123 commented 8 years ago

Good luck! I think most of the issue will be on the home screen. If the mouse hovers over the main menu button kancolle-auto decides to look for next, it will most likely crash.

mrmin123 commented 8 years ago

Merged above code by @minh6a as of e445b6c. Code was further modified in e5f468d to make future mouse rejiggers easier to implement and customize.

I'll leave this issue open in case anyone has further information or ideas regarding bot detection.

n0k0m3 commented 8 years ago

Just did some research and found smt interesting:

http://kancollebot.pixnet.net/blog/post/288508168 => Yes, the client DOES record mouse coordinates (or so it seems)

http://kancolle.wikia.com/wiki/User_blog:Dragonjet/API_Security_and_Possible_Botting => Kadokawa keeps fighting Kancolle Bot - KCB (a Japanese automation tool for Kancolle distributing over freenet) by obfuscating api_port calls

https://github.com/undisputed-seraphim/KanColleAPI => This guys did some dissection on the client and this BOT used api_port calls to do automation tasks (seems similar to freenet KCB), though the project is old (and dropped???), it is still interesting to read.

http://kancollebot.blogspot.com/2014_07_01_archive.html => Finger-crossed :v Lots of players using KCB got banned, and meanwhile players using MouseMacro software still alive (2014)

http://kancollebot.pixnet.net/blog => Homepage for KCB

Overall, I have a feeling that most of Kadokawa's effort in improving BOT detection is to fight KCB-Kai tool and simple macros => our script is in the green zone

I'm also having KCB-Kai source code if anyone wants to dig in.

(Need to learn more Japanese tho ;-;)

mrmin123 commented 8 years ago

@minh6a I believe that first link was linked in a previous discussion on this project regarding bot detection, and I was told that it primarily had to do with the kancolle client tracking mouse click locations, not mouse movement, but I could be wrong.

But yes, one of the reasons I went with amylase's kancolle-auto as a starting platform to write a bot was because it didn't use api calls to do its botting, as that seemed like it would be easier to detect. Using Sikuli, you lock up a machine/VM from doing anything else, but as far as the game is concerned at a very basic level, kancolle-auto probably looks as if a human is playing it. Not being used as much as KCB probably helps, too.

Hopefully kancolle-auto continues to stay 'hidden' from the devs :p

AppleBoi86 commented 8 years ago

Is the latest version safe to use now? I haven't been following the latest updates but I've been using mrmin123's build for some time. I currently stop using this cause I've been detected as bot for using it and was hit with a number of cat error screen but luckily no ban.

n0k0m3 commented 8 years ago

It is not safe to use this mod and never will. (Read the wiki and the disclaimer for more info) Anw if you really want a "safe" mod developed by professional dev, use KancolleBot (link provided above)

mrmin123 commented 8 years ago

@AppleBoi86 When was the last time you used this script? Were random mouse clicks and navigation in the build? Either way, I'll give you my two cents on the matter...

Like @minh6a mentioned it will never be 100% safe to use any bot since Kadokawa/DMM is actively fighting the use of bots (see twitter link in first comment in this issue thread). In a previous issue thread in this repo I had one (1) whole report of a user saying that they were banned while using this tool. Odd thing was they had used it for a very short period of time (a few days or so) and they were banned, while myself and others that had been using it for weeks were still OK. That issue thread was started before I incorporated random mouse click locations and random screen navigation, too, which were added in direct response to the report of the user being banned. The previous issue thread, unfortunately, has been deleted because the person who opened the issue deleted their Github account.

That said, I think using kancolle-auto is a relatively safe option, as long as it's configured properly. I present the following reasoning with two huge caveats: 1) I'm the developer of kancolle-auto and 2) I'm still not banned (yay for sample size = 1):

Again, I've not ripped apart the official Kantai Collection game to look at its anti-bot mechanisms, nor do I know what Kadokawa is doing to track and identify bots, so all of the above points could be for naught.

I can't comment on whether or not KancolleBot @minh6a mentioned above is a better choice since I've not looked into the other botting options for this game. I'm not sure what he means by 'safe' (or 'professional') since in a previous comment he explicitly stated that people were banned using it and that Kadokawa/DMM are targeting users of KancolleBot. Either way, there's always a risk.

I hope this was informative in helping you make a decision on whether to use this tool or not.

AppleBoi86 commented 8 years ago

Judging by Date modified. It's 09/10/2015, the date I first create folder / use your work. I've been using that build until last few weeks where I gave up cause I keep getting cat error screen after using it for a day.

mrmin123 commented 8 years ago

Judging by the changelog, mouse randomization was incorporated 2015-10-18. Since then a lot of other stuff has also made it in. If the changes sound good to you and you're willing to take another risk, I'd say by all means try an updated version of this tool.

AppleBoi86 commented 8 years ago

Neat! Everything feels different with the current version. I give this a shot and hopefully all is good. Loving the mouse is now moving all over the place instead of just station at each intervals.

Aftersky commented 8 years ago

@AppleBoi86 How long did you run the bot for? did you use scheduled sleep?

I've encountered the frequent cat bomb error twice which lasted for over a week each time (until there is a maintainance) but only because I was greedy and ran kcbot without pause for 22-24 hours a day.

I haven't encountered it again since I lowered botting time and amount of actions generated per day.

AppleBoi86 commented 8 years ago

That is probably the case too. The latest cat error I encounter was that I forgot to turn off my KC and allow it to work through out the night, was only running expeditions. Only to be greeted with a cat error screen the next morning.

Also, the old version of mrmin123's build I used didn't have the Scheduled Sleep option.


I like some guidance on how to set this up if I want it to sleep on 0200 > 0600

The scheduled sleep/pause start 'window'. Specify, in military time, a period of around 30 minutes for when you want the scheduled sleep/pause to start. ScheduledSleepStart1 = 0030 ScheduledSleepStart2 = 0100

How long you want kancolle-auto to sleep, in hours (decimals are OK). ScheduledSleepLength = 3.5

mrmin123 commented 8 years ago

@AppleBoi86 I would change it to the following:

ScheduledSleepStart1 = 0200 ScheduledSleepStart2 = 0230 ScheduledSleepLength = 3.5 or 4

The ScheduleSleepStart1/2 are kinda weird, but they're what I have set up right now >_>

mrmin123 commented 8 years ago

Please continue any discussion regarding bot detection in ticket #130!