8 ms·
Show HN: Hacking slot machines with a buttonhole camera and brute-force search
- deleted 8y ago[deleted]
- hirundo 8y agoIs the use of this code as described legal? If so why not milk it? If not why risk assisting?
- dawnerd 8y agoProbably a good way to get beat up by casino thugs I’d imagine.
- greymeister 8y ago"I'm just curious. I saw you shuffling your checks with your right hand. Can you do that with both hands?"
- adrianN 8y agoSo a guaranteed way to win a court case for damages?
- SmellyGeekBoy 8y agoThe machine described isn't really a "slot" machine in any traditional sense of the word and you wouldn't find one in a casino. It's a pub quiz machine.
- a_t48 8y agoI would guess the odds of the machine are set up in such a way that it’s still not profitable to do this.
- deleted 8y ago[deleted]
- a_t48 8y agoNever mind. Had assumed this was a bonus game on a slot, it’s actually the whole thing. Neat.
- benatkin 8y agoPlease nobody click on the report button on the GitHub repo. (The user/submitter look to be anonymous)
- javindo 8y agoUnder fairly draconian UK law where this is based, probably not: https://www.legislation.gov.uk/ukpga/1990/18/contents https://www.legislation.gov.uk/ukpga/1990/18/contents
- SmellyGeekBoy 8y ago"Draconian" it may be, but I think I'd rather get caught cheating at gambling in the UK than in the US, for example.
- jamesough 8y agoThe game was recently retired from machines and I left the game ROM out. Fun as a challenge though!
- cwkoss 8y agoVery cool! What accuracy rate were you able to achieve?
- jamesough 8y agoAccuracy is high enough!
- rbobby 8y agoDude... did you just confess to a crime?
- benatkin 8y agoCould be browsing and pushing to GitHub on Tor. Biggest danger might be semantic analysis of his comments or code linking it to his real identity.
- craftyguy 8y agoWell the original gif showed part of his face, he has since removed that from his repo and history, but there are several forks where it is still visible. So, anonymous fail.
- jamesough 8y agoIt's not anon. The game was retired from machines and I left the ROM out. Hourly rate probably wouldn't be very high if you did try to actually make money. Fun challenge though!
- jnbiche 8y agoPlease don't assume to know what is legal or not in another jurisdiction. Not all states or countries have the same gambling rules as Nevada.
- oh_sigh 8y agoWould it also be a crime to just remember every question and answer in the game?
- p1necone 8y agoI'm shocked that there's an ostensibly skill based slot machine.
- owlninja 8y agoYea, where would one find a machine like this? Doesn't really seem like a slot machine to me.
- jamesough 8y agoThese are typically found in university towns in the UK.
- barbecue_sauce 8y agoAn answer below about denomination (pounds instead of dollars) implies that it's in the UK. Definitely wouldn't expect to see something like this in the states.
- dagw 8y agoI've seen several machines like this in various bars in Sweden at least.
- Timmah 8y agoThe Nevada gaming industry is lobbing heavily to legalize them. So they can target younger demographics.
- dymk 8y agoIf I could loose money because I'm just unskilled at something (but had fun) rather than just got unlucky, I'd absolutely use one of those machines.
- albertgoeswoof 8y agoIt doesn’t really work like that, eg if you play the quiz one, when you get past £3 the questions become ridiculous, like what is the size in cubic meteres of lake Victoria? 40040400303 40404940404 or 4940403030 etc So it just ends up being luck really. They also pay out a fixed amount and the difficulty rapidly increases if you keep winning.
- theoh 8y agoSo what should the book (following the example of "The Newtonian Casino") be called? I mean, what is actually nontrivial (pun intended) here?
- splonk 8y agoFor non-Brits, "The Newtonian Casino" is probably more commonly known as "The Eudaemonic Pie". It's about a group in the 70s using electronic devices to clock roulette wheels to predict the general area of the wheel the ball would fall into and make better bets. An earlier attempt by Thorp (of "Beat the Dealer", probably the most famous blackjack counting book) and Claude Shannon (yes, that Claude Shannon) is covered in part of the book "Fortune's Formula".
- spappal 8y agoThis article [0] explains nicely the story of Claude Shannon et al trying to win at roulette. [0] http://nautil.us/issue/50/emergence/claude-shannon-the-las-vegas-cheat http://nautil.us/issue/50/emergence/claude-shannon-the-las-v...
- jamesough 8y agoYes! This was very much inspired by Shannon and Thorp. I love that story.
- rbobby 8y agoYikes. Using this is almost certainly illegal (cheating) in every jurisdiction, and could have significant penalties. This video and the github repository itself could be a crime... teaching someone how to cheat using a cheating device. Heck even publicizing the video could get one sucked into the potential mess. Intention may play a part (i.e. was there any criminal intent in making the video/code/etc). Would depend entirely on jurisdiction and the specifics of the legislation. Sure... it's a fun/cool project with lots of tricky parts to get right/play with. But I think the author should exercise a bit more caution. If you need a lawyer to be sure that your project won't land you in jail... perhaps choosing a different project would be a good idea.
- Someone1234 8y agoWhich specific law(s) do you believe this breaks? While it is illegal for the house to cheat most places, and while a punter may break other laws trying to cheat (e.g. trespassing, tampering, etc), I'm not aware of a specific law against cheating. I'm also not aware of a law banning the distribution of materials that may help one cheat (except DMCA? Copyright?).
- lgas 8y agoDepends on the jurisdiction but for example in Las Vegas (http://www.gambling-law-us.com/State-Laws/Nevada/ http://www.gambling-law-us.com/State-Laws/Nevada/) I believe this would fall under NRS 465.070 numbers 2, 5, and/or 7.
- deleted 8y ago[deleted]
- Someone1234 8y ago2, and 5 only apply to "game[s] or other event[s]" which has a specific definition (namely it is about e.g. sports betting and other live events). 7 doesn't apply at all since he didn't alter or manipulate the machine in question, it is working as intended. Plus the claim was: > in every jurisdiction Nevada has some of the most strict gambling laws in the world (and showing it is illegal in Nevada hasn't even been satisfied yet).
- clwk 8y agoAll I have to say is that I misread this headline and experienced both disappointment and relief when I clicked through and read about a 'buttonhole' camera.
- browsercoin 8y agoI didn't quite back it past 'butt'
- jamesough 8y agoV2 will be available as a custom suppository.
- itronitron 8y agoin which case you will need to implement a cavity-search algorithm
- pavel_lishin 8y agoDepth-first, of course.
- yetiofparis 8y agothe rep is dated 2 years ago?
- NKosmatos 8y agoExactly and some “peculiar” edits in the readme... Seems to be for a UK specific machine.
- yetiofparis 8y agoI guess this guy has been milking his code and is rich by now!
- malwrar 8y agoFYI to author, the video that you tried to delete (quiz.gif) is still accessible. It's still in your git history and can still be viewed easily, probably don't want casino people seeing your face :P
- jamesough 8y agoLooks like a case for <git-filter-branch>
- available 8y agoIt's strange that he basically removed the entire history, but kept a couple of commits such that the 'face' gif can still be accessed? Regardless, several forks exists with the original history dating back to 2016. So it's probably too late to do anything about now.
- jamesough 8y agoYeah, it's not anon: the game was retired from machines and I left the ROM out. Wouldn't recommend to do for other than fun (and tbh hourly wage would be very small), but was a fun side-project!
- splonk 8y agoNote that this appears to be in the UK, given the branding of the machine and the poster's comments. I'm not sure what the legality is there, but it sounds like it's a less regulated form of low stakes gambling, so maybe it's practical there. I imagine whoever's responsible for the machine would kick you out in a hurry, though. I know there's some been some other rulings that make UK law pretty bad for advantage players, so it also wouldn't surprise me if this is illegal there as well. In the US, this would generally not be called a "slot machine" - more like a bar trivia video game from what I can find, which most likely wouldn't pay out money. US casinos and slot developers are putting some skill-based elements in their machines, but those are generally added as bonus rounds to regular slot machines. In any case, using an electronic device on a casino floor is generally not a good idea in the US. For example, in Nevada, "NRS 465.075 Use of device for calculating probabilities. It is unlawful for any person at a licensed gaming establishment to use, or possess with the intent to use, any device to assist: 1. In projecting the outcome of the game; 2. In keeping track of the cards played; 3. In analyzing the probability of the occurrence of an event relating to the game; or 4. In analyzing the strategy for playing or betting to be used in the game, except as permitted by the Commission." In practice there is some leeway on this - sitting at a video poker machine, nobody's likely to hassle you for looking up perfect strategy on your phone. On the other hand, most table games dealers will tell you to leave the table while using your phone. It's fine to have a paper card with blackjack basic strategy, but not to check the same information on your phone. But in any case, the rig described here is not going to be a good idea anywhere in the US I'm aware of, and that's assuming you can even find a skill-based machine with sufficient payouts to justify trying it.
- JoeSmithson 8y agoI wrote a similar program a while ago to cheat at Word Soup which is another of the games on these machines. http://chris-knott.appspot.com/projects/word_soup.html http://chris-knott.appspot.com/projects/word_soup.html They are technically not gambling. There are two different regulations in the UK - Amusements With Prizes, which are random and you need to be 18+ to play, and Skills With Prizes which are technically skill games and you don't need to be 18 to play, or have a gambling license to run.
- deleted 8y ago[deleted]
- splonk 8y agoLooks like the likely top prize on these is 50 GBP. From https://www.gamblingcommission.gov.uk/for-gambling-businesses/Compliance/Sector-specific-compliance/Arcades-and-machines/Skill-with-prizes-SWPs.aspx https://www.gamblingcommission.gov.uk/for-gambling-businesse...: "What is the maximum stake/prize on an SWP? As you don’t need a licence or permit there is no legal limit for stake or prizes. However, it would be very difficult to manufacture a genuine SWP machine that is economically viable and offers prizes over £50 (the prize limit set by the industry trade body following discussion with us). We would be likely to raise questions about machines with prizes above this range."
- peteretep 8y agoI spent at least 6 months when I was 19 playing this and mentally designing an app to do this. Awesome that you did it!
- downandout 8y agoFYI I’m getting an “Over Quota” error when trying to access your site.
- JoeSmithson 8y agoWhoops, guess HN used up my bandwidth. Here's a video on YouTube https://youtu.be/PICrG3X8XIU https://youtu.be/PICrG3X8XIU
- stilley2 8y agoCool project (legal/ethical issues aside)! My big question is why bother with OCR at all? Presumably you can construct a representation of the screen for each question ahead of time, and you already solve the projective transform due to the camera, so at that point why not pick some appropriate distance metric and pick the question/answer pair corresponding to the virtual image that is closest to the camera image?
- dclowd9901 8y agoAt the very least, they probably mix up the order of the answers. On that basis, you immediately multiply the variants by 4!. I wonder if it would be faster to do that comparison or not. And this ignores any potential background animations or other non-static entities on the screen there might be.
- deleted 8y ago[deleted]
- jamesough 8y agoThey mix up the answers. And sometimes choose 4 answers from a possible selection of 20.
- stilley2 8y agoAh that makes sense. Thanks
- kwhitefoot 8y ago> ethical issues aside What might they be? It seems to me perfectly ethical to fight back against the heavily stacked odds.
- splonk 8y agoRelated: there are various bots for HQ Trivia that do similar things that have come up on HN before. Here's one with a bit of a writeup: https://medium.com/@tobymellor/hq-trivia-using-bots-to-win-money-from-online-game-shows-ce2a1b11828b https://medium.com/@tobymellor/hq-trivia-using-bots-to-win-m... My general impression is that being able to screenshot and use real computing power is a fair bit easier than using OCR on a Raspberry Pi, but question parsing and querying Google is a lot harder than using a static corpus of questions and answers.
- applecrazy 8y agoI've built a similar proof-of-concept HQ Trivia algorithm before[0], and from my simple tests, in most cases isn't any additional work needed, just naively send the OCRed question to Google. Of course, some questions don't work using this naive approach, which is why a similar HQ Trivia bot used riffed on this concept with unique (and clever) heuristics[1]. And yes, it is easier to work with a screenshot than a grainy image of text produced by a camera. [0]: https://applecrazy.github.io/blog/posts/protect-trivia-from-bots/ https://applecrazy.github.io/blog/posts/protect-trivia-from-... [1]: https://hackernoon.com/i-hacked-hq-trivia-but-heres-how-they-can-stop-me-68750ed16365 https://hackernoon.com/i-hacked-hq-trivia-but-heres-how-they... Edit: my HQ Trivia system was a simple 1-hour weekend project, so it is by no means perfect. Also, to prevent my Github from being taken down, none of the code is available.
- bdod6 8y agoMux wrote a blog post about this too: https://mux.com/blog/how-we-used-machine-learning-to-predict-hq-trivia-answers/ https://mux.com/blog/how-we-used-machine-learning-to-predict... Using machine learning to parse text helps, but it's still not a perfect solution.
- kregasaurusrex 8y agoI'd previously done OCR work with Twitch streams, but the reliability of the Tesseract libraries for custom fonts had stopped me from going any further with it. Since HQ uses a standardized font library, I'd imagine character extraction would be more successful when recording from screenshots because it would likely be closer to the library's training datasets.
- foota 8y agoSo... Can you not just memorize the questions?
- deleted 8y ago[deleted]
- cdubzzz 8y agoUnfortunately a little late for the git history wipe... https://github.com/tensor8/hacking_slot_machines/network/members https://github.com/tensor8/hacking_slot_machines/network/mem...
- flocial 8y agoIt's already linked to a non anonymous profile and his email is in the git history so...
- jamesough 8y agoYeah, it's not anon: the game was retired from machines and I left the ROM out. Wouldn't recommend to do for other than fun (and tbh hourly wage would be very small), but was a fun side-project!
- toast0 8y agoIf you have all the questions and answers; couldn't you just study them? It's not as fun, but probably just as effective, depending on your ability to retain useless knowledge.
- jamesough 8y agoI tried this initially and put all 30K questions in Anki. I learnt about 97% of them, but it still wasn't good enough to win
- petercooper 8y agoAppreciate this is a tangent, but if you learnt almost 30K trivia questions off by heart.. have you found that has benefitted you in other ways? Like, being killer at quiz shows or University Challenge or something? :-)
- jamesough 8y agoI got asked to be on a University Challenge team after someone saw me playing... but completely flopped when they asked independent questions at trials. This kind of unlinked data leaks very fast, too: at my peak I had to top up with Anki for about 3 hours a day. I've forgotten almost all of it now. A small consolation is that I can still tell you the 'exact number of gallons of water' in most major lakes.
- perl4ever 8y ago"the exact number of gallons of water in most major lakes" I don't think there is such a thing.
- braythwayt 8y agoThe exact numbers listed in various reference texts, then.
- KODeKarnage 8y agoI have accidentally read the title of this post half a dozen times, and each and every time I read it as saying "butthole".
- nneonneo 8y ago> The game data files look like this; encrypted, unreadable text. Fortunately, it turned out that they were encrypted using an xor cipher. This means that we can fairly easily write a script to get a list of questions and answers in human-readable, decrypted form. I mean, it doesn't much matter how these things are encrypted - since they have to be decrypted to display the questions and answers on-screen, the code and any necessary keys will be present in the game code. You'd only need to reverse engineer the ROM enough to know where the decryption code is, and invoke that code (or reverse it and write a compatible implementation). It just so happens that the encryption is weak enough here that reverse engineering is not required.
- jamesough 8y agoYes, and the decryption code had been bundled into the binary! I tried inspecting it as you say but it seemed easier to just solve it by hand.
- yadaeno 8y agoUnless the key could be in a separate hardware component.
- brian-armstrong 8y agoThis isn't necessarily true. A lot of machines like this use a security dongle to perform decryption which means it is very hard to get the data except by scraping it while it's running (and even then, this can be quite hard)
- purplezooey 8y agoAnybody rich yet?
- cptaj 8y agoMan, I read butthole and thought this was a totally different kind of project.
- deytempo 8y agoThat is the most epic thing I’ve read today besides titans of mathematics
- Latteland 8y agoImagine if Linus Torvalds was a mathematician, that would have been even more interesting to read.
- jamesough 8y agoV2 will be available as a custom suppository.
- ct520 8y agoLOL me too. Has to reread title three times
- deleted 8y ago[deleted]
- hn_username 8y agoThis is a really clever and interesting project - thanks for sharing. How on earth did you come across the ROM for this game?
- jamesough 8y agoMany hours of searching through internet archives of dead forums. I don't think you can find it any more.
- craftyguy 8y agoDo you plan to mirror it somewhere (e.g. throw on bittorrent for a bit)?
- jamesough 8y agoNah this was really just a fun side-project, just posting as proof-of-hack. Also this specific game was retired from machines. Fun as a challenge, though!
- deleted 8y ago[deleted]
- hn_username 8y agoThat's great to set out looking for something like that and actually find it!
- downandout 8y agoJust FYI everyone, using any electronic device to gain an edge at any regulated gambling game is a felony in Nevada, and it is one that they take incredibly seriously. If you are caught doing this in Nevada, and they will certainly be watching for this now that this has been posted, you will go to jail. I cannot speak for any other jurisdiction, but I’d highly recommend not using this in Vegas or Reno.
- kwhitefoot 8y agoIt seems that this kind of machine doesn't exist in Nevada so it's not relevant, yet.
- kuroguro 8y agoAny electronic device huh... time to go mechanical!
- mfgs 8y agoRaspberry Pi is slow for image processing. You can probably greatly increase speed if you take smaller images or downsize them before processing.
- maym86 8y agoCould just run the software on an Android phone.
- LeoPanthera 8y agoThis is covered in the article. The image is sent to a backpack laptop for processing.
- anonu 8y agothis probably isn't a slot machine game you'd find at a casino...
- wst_ 8y agoNot directly related, but similar approach... Around 20 years ago. One of the eastern block countries, short after the transformation. Officially democratic but practically in a limbo between old and new system. Gambling law allows to run casinos but also a small slot machine parlors - gambling dens for poor and naive, occasionally getting rich for a short time, before they loose everything again and put in even more. Novomatic slot machines are deployed in large quantities in those places. Among them American Poker 2 (which you can play using MAME [1] if you like.) A crud machine, considering AAA games released at the time, nonetheless serves its purpose well. No one cares about 3D and shaders in those places, anyway. Two men enter the parlor. One does not speak local language at all, the other is born local but lived abroad long enough to get the weird accent. They buy a game for a minimum amount of money and lose everything fast. Not even trying to win, just passing cards at the same time noting the sequence in cell phone. Cell phones aren't allowed in the parlor but they are quick, no one sees anything, besides, they are trained in memorizing the sequence if needed. They leave the parlor "for a smoke," come back after few minutes, insert a minimum amount again and win every single deal. That must have been a really lucky smoke! They cash in a lot, leave a considerable tip to the staff and off they go. Apparently American Poker 2 is popular in whole eastern Europe at the time and, apparently, ROM version is the same everywhere. They are visiting every city big enough to have multiple parlors. They are visiting multiple countries in the region. They don't work alone, obviously. They become bold and try to cut a deal with a parlors' staff. In many places they succeed - it's a lousy job in lousy place. Especially on night shifts and they rarely visiting during the day. It's safer that way. So they come, they get a tip from the staff about which slot machine is money fat this night. It matters more for the staff then for them, it looks better in daily report. They win, share some with the staff and go to another parlor or another city. But sooner than later a pattern starts to form and some notices the behavior of two always winning regulars. Gossip starts to follow them. It's harder to get by unnoticed. In the end, maintenance crew updated the game ROM in all machines and the trick stopped to work. At least for a while. No one ever caught the lucky winners. [1] http://www.gamesdatabase.org/game/arcade/american_poker_ii http://www.gamesdatabase.org/game/arcade/american_poker_ii
- rmetzler 8y agoA lot of slot machines used to work like that. The outcome appears to be random, but is in fact a big hard coded table determining the outcome depending on current state. If you know the table and are able to determine the state of the machine, it's easy to cheat the game. I remember having read similar stories about slot machines in Germany.
- everdev 8y agoApplaud the ambition, but please be careful. People go to jail in the US for trying to hack or cheat at gambling games.
- lysp 8y agoA friend "hacked" a similar betting gaming machine. The game cost $2 to play. It loosely followed the payout rules of the TV show "who want's to be a millionaire". There were about 10-12 levels and every 2-3 wins you'd get to a checkpoint where you could cash out or continue playing for more money. Each level was slightly harder in difficulty/time with 3 "prize/payout" levels, which changed based on how much the machine had paid out recently. You could generally win anything from $10-$40 per play. It had about 8 different games you could play (one being sports trivia). One of the games you could choose was "spot the difference" where you have 2 images side by side and you needed to touch the screen in a set amount of time to find the 5 differences. The method my friend worked out to "hack" the machine was to cross his eyes and merge the 2 images into one, similar to the stereogram "Magic Eye" images you can find. By crossing his eyes and merging the images into a single one - the differences stood out really clearly. This lasted a few months with him and his friends cashing in on all the machines in the area, whenever their prize level was high. Eventually the software company worked out there was a problem with that specific game and updated their software. It didn't pay out as high on that game. And the top prize level had to be completed in under 2 seconds. Which when you're trying to press a not-so-great touch-screen 5 times in 2 seconds, was not possible as not all presses would register if you touched it really quickly.
- adrianN 8y agoAmazing that people would code up a "spot the difference" type of game where you can win money without reading up on the techniques used to solve that type of game.
- jakobegger 8y agoInteresting that they "fixed" it by making it impossible to win. Gaming / betting companies are pure evil.
- jhanschoo 8y agoWell, gambling is a luck-based game and this pretty much puts the luck in what is supposed to be a luck based game. Casinos aren't obliged to give their customers money if those customers know a neat trick, y'know.
- dabockster 8y agoI read that as "butthole camera"
- kashosoft 8y agositting at a video poker machine, nobody's likely to hassle you for looking up perfect strategy on your phone. On the other hand, most table games dealers will tell you to leave the table while using your phone. It's fine to have a paper card with blackjack basic strategy, but not to check the same information on your phone. But in any case, the rig described here is not going to be a good idea anywhere in the US I'm aware of, and that's assuming you can even find a skill-based machine with sufficient payouts to justify trying it. https://www.programsnow.com/ https://www.programsnow.com/
- LeonM 8y agoIf you are into this kind of stuff, I'd highly recommend Kevin Mitnick's book 'Art of intrusion'. The first chapter describes how a group of engineers (I'd think somewhere in the 80s, early 90's) reverse engineered a popular Las Vegas poker machine, and managed to walk away with milions in profit.
- hnu0847 8y agoHere's another good read: https://www.wired.com/2014/10/cheating-video-poker/ https://www.wired.com/2014/10/cheating-video-poker/
- deleted 8y ago[deleted]
- dentisto 8y agoReminds me of https://priceonomics.com/the-man-who-got-no-whammies/ https://priceonomics.com/the-man-who-got-no-whammies/
- hn_username 8y agoLooking at the cpp code, could you describe the prototype/pattern image? What sort of prep do you do to make it generally recognizable as the questions/answers change?
- nimbius 8y agobe careful with this hack and similar ones...real-life casinos have an entire SOC monitoring absolutely everything on the floor and in the parking lot. Speaking from experience: As a young and foolish lad I was once arrested and spent four days in the frigid Clark county detention center in Nevada for stealing a set of dice from an unattended craps table over a holiday weekend. I made it about five paces from the table before I was arrested by four guards.
- beeforpork 8y agoMan, I read 'butthole camera' instead of 'buttonhole camera' and was confused (and curious). I need more coffee... [Plus I find I am not the first; including wording -- so weird...]