Archive for the ‘Uncategorized’ Category

Python Client for DLP API (Alpha)#, First Python Test

March 15, 2018


I wanted to try DLP from python, as I am not a programmer as well I want to learn Python, I started off with different examples from the DLP pages at Google.
I struggled to get authentification working or finding my DLP project and not the default. On end I got it working the Alpha Library Version of the DLP API version for python. Here you see the Library: .
Here is the crucial documentation for the Library:
Key create :JSON File for the service at  gcloud console : API & Dienste -> Zugangsdaten -> Anmeldedaten erstellen, this download the JSON File .
#!./venv/bin/python (your python binary )
# Google DLP API Basic Test , based on Google Examples and Internet Reserach
# Key Information : Google Cloud Documentation, Release 0.28.1 , API Reference Page 277
# Goal get basic access and test DLP basic
import httplib2
import sys
import argparse
# using google.auth as oauth2client is depreciated
import google.auth
from import dlp_v2beta1
from google.oauth2 import service_account
# Json File for Service Access :
# JSON File created gcloud consol : API & Dienste -> Zugangsdaten -> Anmeldedaten erstellen
# Download des JSON File -> File for the credentatials
credentials = service_account.Credentials.from_service_account_file('/path/yyourcredentials.json')
def main():
# Build the service , add credentials from Services JSON file , as default Environment variables didn't work
client = dlp_v2beta1.DlpServiceClient(credentials=credentials)
# Data for DLP Inspection just for test, used Google Example
info_types_element = {'name': name}
info_types = [info_types_element]
inspect_config = {'info_types': info_types}
type_ = 'text/plain'
value = 'My email is'
items_element = {'type': type_, 'value': value}
items = [items_element]
#DLP Findings
response = client.inspect_content(inspect_config, items)
if __name__ == '__main__':



Raspberry Pi monitor wlan probe request

February 13, 2016

Just want to get in what is a Raspberrypi all about , so I thought what about a simple device that capture mac address of a phones or any wlan devices which enter my home . Ordered a raspberrypi at Amazon including W-Lan USB Stick and addition a case with touchscreen display ( used a Tontec display) .
To capture W-Lan devices is easy , as W-Lan devices send probe request to see if there are WLAN/WIFI Hotspots out there . In order to capture this requests you need to put your Wifi port at Raspberry pi in monitor mode , be aware not every plan stick support this , or have different setup commands .
command : lsusb show you the devices , just like below . where I have 2 adapters .
pi@raspberrypi:~ $ lsusb
Bus 001 Device 005: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

I use the Realtek RTL8188CUS chip Adapter , to bring it in Monitor mode I use the following commands , please check which wlan interface (wlan0 here) you have .
sudo ifconfig wlan0 down
sudo iw phy phy0 interface add mon0 type monitor
sudo ifconfig wlan0 up
sudo ifconfig mon0 up

then to monitor for probe requests I use tshark , below the command :
sudo tshark -i mon0 -f ‘broadcast’ -T fields -e frame.time_epoch -e -e radiotap.dbm_antsignal -e wlan.fc.type -e wlan.fc.subtype

Install shark apt-get install tshark

CENTOS on XEN with VMWare Fusion Install

May 30, 2014

Hi All,

I got XEN on Centos 6.5 as nested VM running in VMWare Fusion 6.03 running , here is how to Install.

Download latest CENTOS ISO Image , I used : CentOS-6.5-x86_64-bin-DVD1.iso

Startup VMWare Fusion , goto Virtual Machine Library Window , add New , goto more Options , select create a custom virtual machine , continue .

Choose Operating System select VMWare ESX , then ESX 5i , continue .

Choose Virtual Disk (no changes ) , continue .

Finish Window select : Customize Setting , SAVE AS pop up , choose your name , I used XEN1 , save .

Settings Window , attach Install Boot Iso as CD , select CD/DVD Drive , switch to on , select your Boot Image File for this was (CentOS-6.5-x86_64-bin-DVD1.iso)  in the autodect bar .

Startup the VM .

Select Install or Upgrade CentOS , do your settings (disk, language , ..)  , I selected on the end the Basic Sever Installation .

Before you install Xen please make sure you have enough Memory assigned to VM ( on my Mac Air with 8GB it assigned 4GB of Memory and 2 cores ) 

No do Xen Install ( used : ) , make sure you have a network running 

yum install centos-release-xen

yum install xen 

Setup Grup for Xen 


reboot . 

Everything done 




Dynamo AWS python script list all tables , structure and items

June 5, 2013

Hi All

just tried to look in Amazon Dynamo and python , as beginner and no programmer , maybe there are others out and I share my work .

All the best

Allways a Beginner


import boto.dynamodb
import boto.dynamodb.condition

#AWS setting
access_key_id = “Your AWS Key”
secret_key = “Your AWS secret key”

#connect to AWS
conn = boto.connect_dynamodb( access_key_id, secret_key)

#list all tables at amazon and show structure
awstables = conn.list_tables()
for item in awstables:
      print “Table: “
      print item
      awstables_desc= conn.describe_table(item)
      print “Tabledescription :”
      print awstables_desc
      # list database items
      awstable = conn.get_table(item)
      if awstable.item_count > 0:
              db_line = awstable.scan()
              for i in db_line:
                      print “Item : “
                      print i

Ruby Rails Beginner try active youtube ( activeyoutube )

March 16, 2009

Hi All

101 Howto for activeyoutube & ruby on rails . I tried to investigate web services and ruby on rails . My simple thought was try to access youtube . So I found activeyoutube ( , gem version which I thought to use . I run in a few issues , maybe because I am a Beginner .

First my Installation :

  • Ruby on Rails 2.2.2 and 2.3.1
  • activeresource 2.2.2 and 2.3.1
  • ruby 1.86

As I run into issues I tried both Rails Versions .

Let’s start :

install activeyoutube :

gem install active_youtube


sudo gem install active youtube

Create Rails youtube project :

rails youtube

Create Youtube Controller

cd youtube

ruby script/generate controller youtube index

edit app/controllers/youtube_controller.rb

Add Require for activeyoutube to app/controllers/youtube_controller.rb : require ‘active_youtube’

Add Index in the controller : def index , end .

Use the the activeyoutube example in the youtube controller for index :

copy the example section from in your controller (app/controllers/youtube_controller.rb):

app/controllers/youtube_controller.rb :

require ‘active_youtube’

class YoutubeController {:vq => ‘ruby’, :”max-results” => ‘5’})

puts search.entry.length

## video information of id = ZTUVgYoeN_o

vid = Youtube::Video.find(“ZTUVgYoeN_o”)


## video comments

comments = Youtube::Video.find_custom(“ZTUVgYoeN_o”).get(:comments)

puts comments.entry[0].link[2].href

## searching with category/tags

results = Youtube::Video.search_by_tags(“Comedy”)

puts results[0].entry[0].title


## retrieving standard feeds

most_viewed = Youtube::Standardfeed.find(:most_viewed, :params => {:time => ‘today’})

puts most_viewed.entry[0].group.content[0].url

#### USER

## user’s profile – guthrie

user_profile = Youtube::User.find(“guthrie”)



## get playlist – multiple elements in playlist

playlist = Youtube::Playlist.find(“EBF5D6DC4589D7B7”)

puts playlist.entry[0].group.content[0].url



Start the rails :

ruby script/server

Connect to Youtube :


You might get this error :

ActiveResource::ClientError in YoutubeController#index

Failed with 406 Not Acceptable

Issue Change in activersource from version 2.1.1 ( more info

Fix :

create file lib/connection.rb

file : lib/connection.rb :

module ActiveResource

# overrides the default ActiveResource Connection Class build_request_headers method because of this error:


class Connection

def build_request_headers(headers, http_method=nil)






Add line on the end connection.rb to your config config/environement.rb

additional line at the end config/environement.rb:

require ‘lib/connection.rb’

Restart Rails :

ruby scribt/server

You might get the next error :

NoMethodError in YoutubeController#index

undefined method `send!’ for Youtube::Video:Class

Issue Ruby 1.8 doesn’t seem to have send! even not all 1.9 Versions ( more Info :

I changed the send! to send /Library/Ruby/Gems/1.8/gems/active_youtube-1.0.0/lib/activeyoutube.rb

New : “#{method_name}#{self.class.send(:query_string, options)}”

Old : “#{method_name}#{self.class.send!(:query_string, options)}”

As I am a beginner there might be a better way , this was my quick and dirty fix .

Restart Rails :

ruby script/server

Connect again with the browser everything seem to work , the requested Info is in shell , not in the browser yet .


March 16, 2009

Welcome to my Blog .  I am working a number of years in the IT and I allways try new stuff , I somehow experienced but not a specialist . I am amazed with the information you find , but on the other hand a lot of Info is only for specialist , so I share my Information when I try new stuff and wher I struggled . I hope this helps others to save time . I also may share thoughts how some technologies can change the Business or the IT .