droberson / ssh-honeypot

Fake sshd that logs ip addresses, usernames, and passwords.
MIT License
620 stars 240 forks source link

Doesn't work on Raspberrypi 2 B #3

Closed marmat8951 closed 7 years ago

marmat8951 commented 7 years ago

Hi, and thanks a lot for your code.

I've tried to make it run on a Raspberry pi, but it won't.

There is no issue with the compilation, but, when I try to execute it, it give me the help informations. I've take on my main computer the exact same configuration using scp to transfer from one to the other, recompil' it, and there are no issues on my main.

Configs: Raspberry Pi 2 B v1.1 with last Stable Raspbian gcc: gcc (Raspbian 4.9.2-10) 4.9.2

Main : MSI GP62-6qe with Linux Mint 18.1 Cinnamon gcc: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

I've added into your code to check lots of printf() to get me where it goes on the raspberry and which are the values, and what it do is in the main() is going in the default case, even with a parameter.

If you need more informations, contact me, I'll try to figure what is happening, maybe just because of a bad gcc version, idk..

droberson commented 7 years ago

Thank you for pointing this out. It has been fixed in version 0.0.7 and is confirmed to work on a rpi 2 running Raspbian.

The problem was that I was using 'char opt' to store the result of getopt(). On x86, a char defaults to signed char. On ARM, it defaults to unsigned char. This was making the result of getopt "opt" store the value of 255 rather than -1 to signify that it was done parsing arguments because negative numbers are impossible with unsigned types.