lunes, febrero 20, 2017

Control SSH Session with Python

$ pip install pexpect

the script:
from pexpect import pxssh
import getpass
try:
    s = pxssh.pxssh()
    hostname = raw_input('hostname: ')
    username = raw_input('username: ')
    password = getpass.getpass('password: ')
    s.login(hostname, username, password)
    s.sendline('uptime')   # run a command
    s.prompt()             # match the prompt
    print(s.before)        # print everything before the prompt.
    s.sendline('ls -l')
    s.prompt()
    print(s.before)
    s.sendline('df')
    s.prompt()
    print(s.before)
    s.logout()
except pxssh.ExceptionPxssh as e:
    print("pxssh failed on login.")
    print(e)
 
Source:
 http://pexpect.readthedocs.io/en/stable/api/pxssh.html

domingo, enero 01, 2017

Sending command from one terminal to another

to get the terminals open:

$ who

to get current termnal:
$ tty

to send command to terminal /dev/pts/11

$ echo test >& /dev/pts/11

domingo, octubre 02, 2016

Desktop Remote Access with x11vnc

install x11vnc server

Servidor:
apt-get install x11vnc

from Client config putty to SSH access:

from client open TightVNC Viewer:


lunes, mayo 09, 2016

Raspberry Pi 3 (Static IP)

In the recent Jessie update, the network interfaces configuration has to be defined with the following steps:

$ sudo nano /etc/dhcpcd.conf

interface eth0
static ip_address=192.168.1.XX/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

$ sudo reboot

jueves, abril 28, 2016

Bug on Google?

there is a strange figure (like a set of litlle snakes) that appears in firefox browser when you try to search from the google site the word gmail

It is a google fault? this also appears in internet explorer.


screenshot from Firefox 45.0.2:


screenshot from Internet Explorer 11: