Bios hacking

Last Updated or created 2023-07-12

Followup on :

I wrote a little python script which checks the checksum of a Bios.

In a previous post i used hexedit to play around changing a Bios dump.

Below posted python script calculates the checkum using the following:

Add all bytes in the file and do a modulo 256 on this number. The output should be 0.

My previous edit gave me a output of C2, so I changed an unused byte FF into (FF-C2) 3D.
No more checksum errors when booting!

Next to do, get a Bios like Glabios or PcXtBios to start my own code from a secondary Eeprom.

import sys

# Bios sum modulo should be 0
# edit  last or unused byte to fix
# python bios-checksum-test.py MYROM.edit.checksum
# 0

f = open(sys.argv[1],'rb')
m = f.read()
print  '%x' % ( ( sum(ord(c) for c in m) & 0xFFFFFFFF ) % 256 )

Python3

import sys

# Bios sum modulo should be 0
# edit  last or unused byte to fix
# python bios-checksum-test.py MYROM.edit.checksum
# 0

f = open(sys.argv[1],'rb')
m = f.read()
checksum =  ( ( sum((c) for c in m) & 0xFFFFFFFF ) % 256 )
print(checksum, 'in hex =', hex(checksum))

Transform photos using gimp

Last Updated or created 2023-06-20

Just back from my 3 week trip to Italy.
Made 5000-odd photos.
Using my posted scripts they are easily sorted.

But some are crooked, lets fix them.

Not a straight horizon:

Lets open this photo in Gimp

Easy to fix:

  • Open in Gimp
  • Go to measure tool
  • Orientation – auto and transform layer
  • Select the horizon on the left (do not release the mouse button) and draw to the right
  • Press straighten

Easy ..

Another fix below : Perspective

Sometimes you want to look straight at a picture, but when taking a picture there is something preventing this.

  • Other tourists won’t move away from a information sign, so you have to take the picture from an angle.
  • The image is far up a wall.
  • Or as in example below, the Roman mosaic is on the floor, no way to take a picture from above.

  • Open in gimp
  • Select from tools > Transform Tools
  • Handle transform or press SHIFT-L
  • Select a corner and drag, repeat until satisfied

Spotify control using python

Last Updated or created 2023-06-08

For usage in this project:

Goto https://developers.spotify.com and add a APP

Write down the Client_id Client_secret and Redirect URL (callback)

Create a bash and python script

#!/bin/bash
export SPOTIPY_CLIENT_ID=2f660e11e70743febdxxxxxxxxxxxxx
export SPOTIPY_CLIENT_SECRET=b0741452a4fe43xxxxxxxxxxxxx
export SPOTIPY_REDIRECT_URI="http://localhost:8080/callback"

python3 spot.py $1

spot.py

import spotipy
from spotipy.oauth2 import SpotifyOAuth
from pprint import pprint
from time import sleep
import spotipy.util as util
import sys

username = "username"
scope = "user-read-playback-state,user-modify-playback-state,playlist-read-private"
util.prompt_for_user_token(username,scope,client_id=SPOTIPY_CLIENT_ID,client_secret=SPOTIPY_CLIENT_SECRET,redirect_uri=SPOTIPY_REDIRECT_URI)

sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope=scope))

# Shows playing devices
res = sp.devices()
pprint(res)

myurl = 'spotify:playlist:' + sys.argv[1]

# Change track
results = sp.start_playback(context_uri=myurl, offset={"position": 1})

## Change volume example
#sp.volume(100)
#sleep(2)
#sp.volume(50)
#sleep(2)

playlists = sp.user_playlists(username)

playlists = sp.current_user_playlists()
for playlist in playlists['items']:
    print(playlist['id'] + ' ' +  playlist['name'])

Run bash script as follows.

playlistplayspotify.sh 0bJvpsn0TDxxxxxxxxxxxx
(0bJvpsn0TDxxxxxxxxxxxx – is playlist ID, as example below)

OUTPUT:

python3 spot.py 0bJvpsn0TDxxxxxxxxxxxx
{'devices': [{'id': 'e86eada2a91e29a396acxxxxxxxxxxxxxxxxxxxx',
              'is_active': True,
              'is_private_session': False,
              'is_restricted': False,
              'name': 'laptop',
              'type': 'Computer',
              'volume_percent': 100},
             {'id': '8571468b6c41973ccb0axxxxxxxxxxxxxxxxxxxx',
              'is_active': False,
              'is_private_session': False,
              'is_restricted': False,
              'name': 'DESKTOP-xxxxxxx',
              'type': 'Computer',
              'volume_percent': 76},
             {'id': '6c592503aa5a22b2fbdxxxxxxxxxxxxxxxxxxxxxx',
              'is_active': False,
              'is_private_session': False,
              'is_restricted': False,
              'name': 'TX-NR1030',
              'type': 'AVR',
              'volume_percent': 41}]}
0bJvpsn0TDxxxxxxxxxxxx Best Classical Music Of All Time
5aL9jeGMCAxxxxxxxxxxxx Programming music
37i9dQZEVCxxxxxxxxxxxx Discover Weekly
6pEJuA1UYJxxxxxxxxxxxx Highland/Small/Border Pipe Music
5p8Tabf5Zwxxxxxxxxxxxx Folk Instrumentals ( Celtic, Irish, Nordic, ... )
1oy8Ek4ddBxxxxxxxxxxxx Lounge
37i9dQZF1Dxxxxxxxxxxxx Irish Folk
etc etc

Checking faulty chips/hardware

Last Updated or created 2023-06-05

When I fix old hardware I often use a flir camera.

My brother gave me his CAT S60 mobile phone. Which has a flir camera, he used it when he was a voluntary fireman.

Forward-looking infrared (FLIR) cameras, typically used on military and civilian aircraft, use a thermographic camera that senses infrared radiation

Soo .. when testing hardware. I do the following.

  • Clean the motherboard
  • Check chip pins
  • Press all chips/ic’s in their sockets
  • Test the power supply disconnected. ( Most will give a higher voltage when nothing is connected )
  • Measure the resistance of the board (sometimes)
  • Check if the machine can be started.

Now it gets interesting. Sometimes nothing happens. Sometimes the machine runs like it suppose to do.

But old hardware can be faulty or connections are bad. IC’s run hot and they stop working. ( Untill they are cooled enough or they stop forever 🙁 )

So I start monitoring the temperature when I boot the machine. Sometimes components heat up very fast. I use my finger and the flir camera.

These are pictures from my 8088. Nothing runs hot