Wednesday, 18 February 2015

Homemade Weather Station [PT 1]

This time i've decided to build an homemade weather station.


I've ordered a month ago a few Dallas DS18B20 one wire digital thermometer and a welded DHT11 (Hygrometer + Thermometer) from an eshop. When i started this project i forgot to buy some matrix boards so i took some really old broken boards (they were mostly old FM radio) and i have unwelded the components. After some PCB modifications i used the old board to weld the DS18B20 with a 4.7K resistor and 3 old cables got from an old (and broken) PC.


I took an old Liquorice metal box and i've isolated the components with the wire tape.


While i was searching for boards, i found an old mini engine for a model railway locomotive and welded it with 2 cables. My future plan for this engine is to use it as an Anemometer.


What's next? Well i found also a solar panel from a broken Chinese calculator (those given as gadgets in the fairs) and i've decided to use it to get the light intensity, but since i have also a photoresistor, i'll probably use both to check the light. The Anemometer (aka the engine) ,the solar panel and the photoresistor will be attached to a MCP3008 (an 8 channel ADC that i got for free).
Photoresistor  |  MCP3008 | 3.3V Solar panel
Now i'm waiting for some components like my Arduino nano v3.0 and some other parts like the raindrops sensor.

For now i've spent less then €2 (less then €1 for the DHT11, €1 for 2 DS18B20).
To test the components (for now) i've used my raspberry pi and my HD44780.

Saturday, 20 September 2014

Raspberry PI + YwRobot Arduino LCM1602 IIC V1 HD44780 LCD


Finally i have some time to write a new post.

Let's start:
I bought a YwRobot Arduino LCM1602 IIC V1 HD44780 LCD from amazon for 6,57 €

It has a I2C interface (so it will use just 2 cables, SDA & SCL, + 2 for VCC & GND).

I found some tutorials online, but they were for Arduino or python... NOTHING FOR C!!
So i decided to write a damn C lib for this component.
I had to cross check various codes/datasheets to understand how it works, but at the end i wrote it.
So, this is my lib! Enjoy it ;)
You can grab from the link at the end of the post.



    #include "stdio.h"  
    #include "string.h"  
    #include "i2c.h"  
    #include "lcd.h"  
      
    #define I2C_FILE_NAME "/dev/i2c-0"  
      
    const char* txt[]  = {  
        "I work on the PI",  
        "via liblcm1602.a"  
    };  
      
    int main(){  
        int i2c_dev;  
        lcd lcd0;  
        // 0x27 is the address of the i2c device  
        i2c_dev = open_i2c(I2C_FILE_NAME, 0x27);  
        if(i2c_dev <0){  
           printf("Error: %d\n", i2c_dev);  
           return 1;  
        }  
        lcd_init(&lcd0, i2c_dev);  
        lcd_clear(&lcd0);  
        lcd_print(&lcd0, txt[0], strlen(txt[0]), 0);  
        lcd_print(&lcd0, txt[1], strlen(txt[1]), 1);  
        close_i2c(i2c_dev);  
        return 0;  
    }  
https://github.com/wargio/liblcm1602

Wednesday, 9 July 2014

Just a simple shell disassembler for ppc64 elfs

I had more the an hour and i decided to write a concept of shell disassembler for the ppc64 elfs, and i used capstone disassembler (capstone [git])

this was the result:







An advice: DO NOT USE MY CODE! it's buggy and has errors!

[Download][git] https://github.com/wargio/disassemble_ppc64

Tuesday, 14 January 2014

Reversing Wii U Executables

First thing to say, Wii U uses Executable and Linkable Format (ELF) with dynamic linking (since Wii U has a real OS), but they are different from the normal ones:

  • Wii U libraries are called RPL
  • Wii U executables are called RPX, but these are actually RPL.
The only difference between RPX and RPL is that the first one has the main entry point, but both are ELFs.Ok, so this is what i understood about the header:
/* Total size 0x500 -> elf + section table */
typedef struct __cafe_elf {
 uint8_t  e_ident[0x10]; // {0x7f,0x45,0x4c,0x46, <-- 'elf'
       // 0x01,     <-- one
       // 0x01,0x05,    <-- sdk version ?
       // 0xca,0xfe,    <-- 0xcafe
       // 0x00,0x00, ... ,0x00} 
 uint16_t e_type;  // 0xfe01 = rpl
 uint16_t e_machine;  // 0x0014 PPC
 uint32_t e_version;  // 0x00000001
 uint32_t e_entry;  // 0x02000000
 uint32_t e_phoff;  // 0x00000000
 uint32_t e_shoff;  // 0x00000040
 uint32_t e_flags;  // 0x00000000
 uint16_t e_ehsize;  // 0x0032 (54)
 uint16_t e_phentsize; // 0x0000
 uint16_t e_phnum;  // 0x0000
 uint16_t e_shentsize; // 0x0028 (40)
 uint16_t e_shnum;  // 0x0015 (19)
 uint16_t e_shstrndx; // 0x0012 (16)
 uint8_t  _pad[0xC];  // zero filled
 uint8_t  zero[0x28]; // zero filled
 uint32_t one_0;   // 0x00000001
 uint32_t one_1;   // 0x00000001
} cafe_elf;


typedef struct __cafe_elf_section_tbl {
 uint32_t flags;  // 0x08000006 <-- example
      // 0x08000000 <-- z
      // 0x00000001 <-- w
      // 0x00000002 <-- a
      // 0x00000004 <-- x
 uint32_t address; // 0x02000000 <-- memory addr (.text)
 uint32_t offset; // 0x0019D740 <-- file offset
 uint32_t size;  // 0x00003EC8 <-- compressed size
 uint32_t data0;  // 0x00000000 <-- unknown
 uint32_t data1;  // 0x00000000 <-- unknown
 uint32_t align;  // 0x00000020 (32) <-- data align
 uint32_t data3;  // 0x00000000 <-- unknown
 uint32_t data4;  // 0x00000007 <-- unknown
 uint32_t data5;  // 0x80000001 <-- unknown
} cafe_elf_section_tbl;
Each section is compressed through ZLIB and has this structure:
typedef struct __cafe_elf_section_data {
 uint32_t decompressed_size;
 uint16_t zlib_compression_hdr;
 uint8_t data[];
} cafe_elf_section_tbl;

Sunday, 20 October 2013

Twitch Streamer for Linux

This Screenshot comes from a linux streaming session.


Since my friend asked me to help him to stream on twitch.tv from linux, i've decided to write something really user-friendly that can be used by everyone. so here it is: Twitch-Streamer-Linux (github)
This little script allows you to stream on Twitch like the non-free apps on windows. You can choose the quality and if stream with the webcam or not.

There is an HOW-TO on the Readme (LINK). if you have any question, just write here or on github.

have fun!

[UPDATE 1]

i have added also some flags to get "Excellent" as quality on Twitch. now works as good as non-free programs :D

Friday, 11 October 2013

Unofficial scetool 0.3.0

I have added an option to add a custom path for the "data" folder.

scetool -v --data-path=$(PS3DEV)/bin/data --sce-type=SELF --compress-data=TRUE --skip-sections=TRUE --key-revision=1 --self-auth-id=1010000001000003 --self-vendor-id=01000002 --self-type=NPDRM --self-app-version=0001000000000000 --self-fw-version=0003004100000000 --np-content-id=UP0001-RSX00004_00-0000000000000000 --np-license-type=FREE --np-app-type=EXEC --np-real-fname=EBOOT.BIN --encrypt EBOOT.elf EBOOT.BIN

https://github.com/wargio/scetool

Thursday, 18 July 2013

Playstation 4 Update Package list is online, but no PUP




Hey readers, as i posted a loooooong time ago on the Ps3 dev wiki (then moved by Euss on the PS4 Dev Wiki) the ps4 update list is finally online!! (yes, servers was already online, but not the files.)

http://fjp01.ps4.update.playstation.net/update/ps4/list/jp/ps4-updatelist.xml

what we can expect inside the PS4 firmware? well, we can get some information by reading the list (don't take my words as 'ABSOLUTELY TRUE', mine are just guesses :D )


<?xml version="1.0" ?>
<update_data_list>
  <region id="jp" >
    <force_update>
      <system level0_system_version="00.000.000" level1_system_version="00.000.000" />
    </force_update>
    <system_pup version="00.000.000" label="0.000" >
      <update_data update_type="full" >
 <image size="1" >http://djp01.ps4.update.playstation.net/update/ps4/image/xxxx/PS4UPDATE.PUP?dest=jp</image>
      </update_data>
    </system_pup>
    <recovery_pup type="default" >
      <preinst_pup  version="00.000.000" />
      <system_pup version="00.000.000" label="0.000" />
      <system_ex_pup id="0" version="00.000.000.000" label="0.000.000.000" />
      <image size="1">http://djp01.ps4.update.playstation.net/update/ps4/image/xxxx/PS4UPDATE.PUP?dest=jp</image>
    </recovery_pup>
  </region>
</update_data_list>

As you can see, there is a "full update" and a "preinst update", called also "recovery pup". 

probably in the future the structure of the PUP link will be this one:

http://d<TLD>01.ps4.update.playstation.net/update/ps4/image/YYYY_MMDD>/pre_<md5>/PS4UPDATE.PUP?dest=<TLD>
(TLD=2 region letter abbreviation, YYYY_MMDD is release date, md5 is 22-digits long HASH)