Archive for the 'Tech' Category

Bad Company 2 – Username Bug

There is a bug in the game that can make playing it online impossible. If a someone connects to a server with a specific style of username then the server lags and it makes the game unplayable until that person (with the bad username) leaves.

The username must be 8 characters long and consist only of 1’s and 0’s.

I tried usernames starting with numbers (1ASDF), starting with multiple numbers (10ASDF) , containing numbers (ASDF2), all numbers but not just 1’s and 0’s (12345).

How this bug came about, a friend of mine routinely uses an alias when playing games that consists of 1’s and 0’s and is 8 digits long. He setup his bad company 2 user account  for the first time at a Lan Party. The moment he connected to the server everyone would lag out. The moment he disconnected the game would go back to normal. At first we never thought the username was the issue because he had earlier issues with his network card not being able to transfer data at a reasonable speed, a cable change and driver upgrade fixed that. We ran WireShark to see if the network traffic changed when he connected and we didn’t notice anything different. Also when he connected someone else in our group and on the same LAN would be disconnected from the game. Another thing that was odd was when we tried to send him a friend request whenever we typed his name (which started with 01) it always added a 1 in front.

We stopped trying to play bad company 2 and moved on to other games. A week or so goes by and he brings up the issue again. He mentioned that he tried changing his name and the game appeared to be working correctly.

That gave me the idea that the game must not be sanitizing some bit of information. Since you aren’t able to run a local server and I am not sure what this bug actually does to the game server (other then lagging everyone), I only did a minimal amount of testing.  I would be very interested to see what’s happening on the server side that’s causing this problem.

I waited until after the bug was fixed before posting this.

iTunes Tricks and Fixing Syncing issues

I recently had a problem syncing my iPhone 5. It would get to step 2 and iTunes would freeze. I was able to do a backup but syncing purchased apps was impossible. After following every possible support forum post someone finally mentioned that the library might be corrupt.

I then went through the process of creating a new library. When you recreate your library it will forget everything that is synced to your iDevices but it will still recognize the devices themselves. You will need to make sure they are in a good state so that you can sync them back to the computer.

Change the Library used by iTunes – Hold CTRL key when launching the application.
Run iTunes in Safe Mode – Hold CTRL+SHIFT

SSH into a Synology NAS using a keypair

or How to Login to your Synology NAS via SSH with a keypair instead of a password.

Required Software

Putty –  http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Config File Editor – Install on Synology using Package Center. Add this URL as a package source: http://packages.quadrat4.de/
(
how to add a new package source http://www.synology.com/support/tutorials_show.php?q_id=500#t2.2 )
This is optional, you can use ‘vi’ instead to edit the ssh config.

 

Overview

  1. Generate the keypair using putty
  2. Edit the ssh config on your Synology NAS
  3. Upload your public key to the NAS
  4. Profit!

Generate the keypair using putty

We are going to use Puttygen.exe to generate a public and private key. The public key will be added to the authorized keys file on the NAS. The private key is what you will use to login. This will be your new “password”.

  1. Launch puttygen.exe
  2. Type of key to generate “SSH-2 RSA”
  3. Generate the Key and leave PuttyGen open
  4. Save the Public and Private keys in a safe place.

Edit the SSH Config on your Synology NAS

Now we need to edit the SSH config file. You can either SSH into the NAS as root or use the Config File Editor you installed earlier. If you SSH in the file is located at  “/etc/ssh/sshd_config” if you are using the Config File Editor select sshd from the dropdown.

Look for these 2 lines

#PubkeyAuthentication yes
#AuthorizedKeysFile      .ssh/authorized_keys

Remove the # (hashtag) so they become

PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

Other values worth setting.

Change the max login attempts

MaxAuthTries 2

Allow TCP Forwarding

AllowTcpForwarding yes

Disable Password authentication (only do this AFTER you have keypair login working.)

PasswordAuthentication no

 

Upload your public key to the NAS

To upload your public key you will need to SSH into your NAS using putty.exe as root (or whichever user you want to enable SSH Keypair login for). Run the following commands from the terminal, ignore the lines that being with # (hashtag)

#cd to /root (this is the users home directory)
cd /root
#create the .ssh folder
mkdir .ssh
#create the authorized_keys file
touch .ssh/authorized_keys

#edit the autorized_keys file
vi .ssh/authorized_keys

#add your public key to the file – copy it out of puttygen.exe
#your public key will look something like

ssh-rsa A__a whole bunch of random characters___bw== rsa-key-20130718

#save the file. exit VI
#change the permissions on the authorized_keys file

chmod 700 /root/.ssh

chmod 644 /root/.ssh/authorized_keys

#disconnect the SSH session

 

Test your settings

Now we are going to use putty.exe to test that we can login with our ssh key.

 #launch putty.exe
#use the following settings.

Connection type: SSH
username: root (or whichever user you setup the key for)
Connection->SSH->Auth->Private Key # Your private key file you created at the beginning of this article.

#press the OPEN button

You should now have logged in to your Synology without having to give a password.

If you are able to successfully login with the private key then you can now disable password login.

NES / SNES Ports to USB

I wanted to have a single box that had both NES and SNES ports with a single USB cable to connect them all to the PC. The benefit of having a USB hub inside would allow me to put a flash drive inside with emulators and roms on it.

 

Equipment:

  • Broken NES
  • Broken SNES
  • USB Hub
  • 26 gauge wire
  • RetroZone NES/SNES USB Kit (4) http://www.retrousb.com/product_info.php?cPath=21&products_id=44

 

Other tools:

  • Screw driver
  • Soldering Iron
  • Glue gun
  • Dremel (variable speed – works best for plastic)
  • ePoxy glue

 

The hardest part of converting the NES/SNES controller inputs to USB Joystick inputs was solved by the RetroZone’s NES/SNES USB kit. The kit comes with a USB cable and PCB with the necessary parts already soldered on. They have easy to use wiring diagrams on the website.

The Retro kit came with the PCB and USB cable soldered together.  To save time and give me more options if I decide to take this apart at a later time I left them attached. This did mean I had to coil up a bunch of extra wires but the spacious room inside the NES made this pretty easy.

I tested each component as I finished them, which helped in finding wiring problems easier. Which is something I did run into with the SNES ports. To test if the port was working correctly I plugged it into the PC, then plugged the appropriate controller into the port. Then I open the “Game Controllers” app (built into Windows), go to the properties of the game pad (RetroZone Kits show up as “Retr”) and there you can see the X/Y Axis and the different buttons. Here is the button number to controller button mapping:

NES

  1. B
  2. A
  3. Select
  4. Start

SNES

  1. Y
  2. B
  3. Select
  4. Start
  5. X
  6. A
  7. L
  8. R

The SNES ports fit almost perfectly in the cartridge slot of the NES. I used a dremel to carve out some of the plastic from the NES lid. The plastic around the cartridge slot gives the SNES ports pretty good support for inserting and removing the SNES controllers. Later (after wiring them up) I used glue to hold them in place.

 

I chose to wire up the NES ports first. It was pretty easy because all of the wires were color coded. I cut the connector off the end and removed the blue and purple wires. The pins pull right out of the NES connector with a pair of needle nose pliers. I tinned the wires (add a little solder before actually soldering and letting it cool) and added solder to the pads on the Retro PCB. This makes soldering the wire to the Retro PCB board significantly easier.

 

 

The SNES ports were soldered to a PCB board. The pinouts weren’t labeled or color coded so I used this (http://www.gamefaqs.com/snes/916396-snes/faqs/5395) wiring guide to match the pinout with the wire color that the Retro kit diagram had. I used 26 gauge wire to connect the SNES ports to the Retro Kit. Again tinning the wirings and the Retro Kit’s solder pads before actually soldering them together helped. I wired up the first port (player 1) and plugged it into my PC. It worked perfectly, something I wasn’t expecting was the power led (which is on the same PCB as the SNES controller ports) lit up. Then I wired up the second port (player 2).

While testing the SNES ports this time, nothing worked correctly. The player 1 port didn’t work at all and the player 2 port was having all kinds of cross talk between the buttons (the A button was being registered as button 1 & 2 being pressed). This can happen if you miss wire one of the ports. I double checked all the wiring and everything was good. Then I started looking at the traces on the PCB board. That’s when I noticed that some of the wires on the ports were connected via the traces on the PCB. Luckily all the traces were on the side of the board that was exposed. So I took my dremel and used it to scrape the traces off. That did the trick and now both of the ports are working.

 

 

Now its time to put it all together. First I glued the SNES ports into the lid. I used epoxy and hot glue to get them to stay. I put the metal piece underneath the SNES ports and was going to screw it into place for added support but decided against it. I didn’t have the appropriate screws and didn’t want to risk them poking up through the lid. I put the RetroZone Kit in an anti-static bag to keep it from shorting. I taped the extra wire to the lid and left enough slack so I could remove the lid and set it next to the base without unplugging the USB cables from the USB hub.

 

Next I used epoxy to hold the USB hub in place in the base of the NES. I made sure to position it so the ports would be accessible and connection in the back. It is a powered USB hub but I didn’t need the power cable because the gamepads and flash drive don’t draw that much power. I did leave the power port exposed in case I needed to add it later. I wrapped the USB cable coming out of the Hub around a plastic post to keep it from being ripped out or from yanking on the hub. I also zipped tied it to the back of the NES where it was coming out of.

The NES ports were easiest to install, then just went back into the spot they came out of. I wrapped up and taped the extra wire to the base.

Then I screwed the case back together, just using 4 screws instead of 6.


The final step was to make sure I didn’t mess anything up when putting it back together. All four ports worked, now its time to play some games.

Surprise.exe

I received a phone call the other day from a friend, now referred to as John He said he kept getting a popup on his screen saying that he was infected with a virus and for the low price of $79.99 this program would remove it. John then started to tell me about this email he received, from someone he knew and he was expecting this person to send him a file. I saw this email, and it looked something like this:

From: luigi
To: john
Subject: i think you will like this
Body:
http://Url.to.surprise.exe

There are a couple things wrong with this picture,
1. The subject is non-descript.
2. The body contained only a link (url) in this case to the virus

If you receive an email like this, I would not click on the link. Even if it is suppose to be a hilarious video of some kid getting attacked by the family cat.

And what happened to him after he downloaded and ran the file sure was a surprise to him. John had 2 anti-virus programs on his computer. Microsoft Security Essentials which we will call MSE for short and Malwarebytes Free Version. MSE did not prevent the installation of this program, however it did find the trojan that Suprise.exe tried to install. Malwarebytes did successfully find and remove the program.

Be very careful with what links you click on. If you think it might be a virus reply to the email and ask your friend if they had intended to send you that email. Its better to be sure then have to worry if your data is safe. John was lucky that he had someone he could call and that the virus didn’t delete any of his data.

References:
Microsoft Security Essentials –http://www.microsoft.com/security_essentials/
Malwarebytes – http://www.malwarebytes.org/