Simple and powerful golang port scanner
https://github.com/Sinute/golang-portScan
Who needs any other port scanner when you can take this one file and compile it to run on both Linux and Windows? And better yet, change the number to workers from 5 to 300 now you can scan an entire /24 network in 3 seconds.
Note that the program seem to have an issue with "\r" and "\n", which suggests that the program may have been developed on a Mac. No problem, simply replace swap "\r" and "\n" in the source and you are ready to go.
August 23, 2013
August 4, 2013
August 2, 2013
Download Java JRE JDK using wget script
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u4-b20/jdk-7u4-linux-x64.tar.gz"
More Info get http://ivan-site.com/2012/05/download-oracle-java-jre-jdk-using-a-script/
August 1, 2013
Virtualbox high network latency with multiple CPU Cores
On Virtualbox 4.2, if you assign multiple cores to your VM, and you are running Linux Guest, you may experience high network latency (ssh typing is sporadic even on local GigE network).
This is a bug with Virtualbox.
The solution: Change your VM Ethernet type to PCnet. Then it works!
Here is the link to the bug report: https://www.virtualbox.org/ticket/10157
This is a bug with Virtualbox.
The solution: Change your VM Ethernet type to PCnet. Then it works!
Here is the link to the bug report: https://www.virtualbox.org/ticket/10157
July 23, 2013
A good Windows SSH/Telnet Server
http://www.kpym.com/
- Free, Open source,
- works with putty in full color, and full window size
- and command auto complete works well
- what else could I ask for?
July 15, 2013
linux dummy interface and renaming
In linux, there is a kernel module called "dummy", which allows you to generate dummy network interfaces such as "dummy0", "dummy1", etc.
1. sudo modprobe dummy numdummies=2
2. now you can do "ifconfig dummy0 192.168.1.124" to give it an IP address.
3. you can also rename the dummy interface with the following command:
ip link set dummy0 name eth3
you need to "down" the interface before running the command above.
With the combination of dummy interfaces and ability to rename dummy interfaces, you can do a lot of fun things with them.
1. sudo modprobe dummy numdummies=2
2. now you can do "ifconfig dummy0 192.168.1.124" to give it an IP address.
3. you can also rename the dummy interface with the following command:
ip link set dummy0 name eth3
you need to "down" the interface before running the command above.
With the combination of dummy interfaces and ability to rename dummy interfaces, you can do a lot of fun things with them.
July 11, 2013
initramfs with boot argument init=/bin/sh
If you use a Linux kernel with initramfs, the boot argument "init=/bin/sh" would not work. The correct one is "rdinit=/bin/sh". Aha. Gotcha.
July 10, 2013
July 9, 2013
Add new file type to ack-grep
If you use ack as your grep replacement, and would like to add a new file type, do this:
Create a file at ~/.ackrc with the following line (change Ruby to your file type, and .haml,etc to your actual file extension):
Create a file at ~/.ackrc with the following line (change Ruby to your file type, and .haml,etc to your actual file extension):
--type-add=ruby=.haml,.rake,.rsel
July 1, 2013
How to hide/remove OS field in Bugzilla
This method uses javascript to hide the unwanted fields
1. edit template/en/default/global/header.html.tmpl. Search for "global.js". After the line "[% END %]" add the following lines:
[% starting_js_urls.push('//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js') %]
[% FOREACH javascript_url = starting_js_urls %]
[% PROCESS format_js_link %]
[% END %]
[% starting_js_urls.push('js/my.js') %]
[% FOREACH javascript_url = starting_js_urls %]
[% PROCESS format_js_link %]
[% END %]
1. edit template/en/default/global/header.html.tmpl. Search for "global.js". After the line "[% END %]" add the following lines:
[% starting_js_urls.push('//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js') %]
[% FOREACH javascript_url = starting_js_urls %]
[% PROCESS format_js_link %]
[% END %]
[% starting_js_urls.push('js/my.js') %]
[% FOREACH javascript_url = starting_js_urls %]
[% PROCESS format_js_link %]
[% END %]
2. create the file js/my.js with the following contents:
$(document).ready(function(){
$("#os_guess_note").parent().hide();
$("#field_container_op_sys").parent().hide();
$("#field_container_rep_platform").parent().hide();
});
This hides three fields: OS, OS comment, and Hardware.
To remove more clutters, use the following js:
$(document).ready(function(){
$("#os_guess_note").parent().hide();
$("#field_container_op_sys").parent().hide();
$("#field_container_rep_platform").parent().hide();
$("#op_sys").closest("tr").hide();
$("#bz_url_input_area").closest("tr").hide();
$("#tag_container").closest("tr").hide();
$("#dependson").closest("tr").hide();
$("#blocked_input_area").closest("tr").hide();
$("#show_dependency_tree_or_graph").closest("tr").hide();
$("td.bz_section_spacer").closest("tr").hide();
$(".bz_collapse_expand_comments").closest("td").hide();
$("div.bz_add_comment").hide();
$("#xml").hide();
$("#comment").attr("rows","2");
$("#attachment_table").hide().before("<button id='tz_bug_edit' style='width:50px'> <b>Edit</b> </button>");
$("#add_comment").hide();
$("#tz_bug_edit").prevAll("br").remove();
$("#tz_bug_edit").click(function(){
if ($("#attachment_table").is(":visible")){
$("#attachment_table").hide();
$("#add_comment").hide();
}else{
$("#attachment_table").show();
$("#add_comment").show();
}
return false;
});
});
$("#bz_show_bug_column_1").append($("#bz_show_bug_column_2").html());
$("#bz_show_bug_column_2").remove();
$("table.edit_form").css("width","auto").css("float","right").find("th").css("text-align","left");
$("#changeform").css("min-height","400px");
To remove more clutters, use the following js:
$(document).ready(function(){
$("#os_guess_note").parent().hide();
$("#field_container_op_sys").parent().hide();
$("#field_container_rep_platform").parent().hide();
$("#op_sys").closest("tr").hide();
$("#bz_url_input_area").closest("tr").hide();
$("#tag_container").closest("tr").hide();
$("#dependson").closest("tr").hide();
$("#blocked_input_area").closest("tr").hide();
$("#show_dependency_tree_or_graph").closest("tr").hide();
$("td.bz_section_spacer").closest("tr").hide();
$(".bz_collapse_expand_comments").closest("td").hide();
$("div.bz_add_comment").hide();
$("#xml").hide();
$("#comment").attr("rows","2");
$("#attachment_table").hide().before("<button id='tz_bug_edit' style='width:50px'> <b>Edit</b> </button>");
$("#add_comment").hide();
$("#tz_bug_edit").prevAll("br").remove();
$("#tz_bug_edit").click(function(){
if ($("#attachment_table").is(":visible")){
$("#attachment_table").hide();
$("#add_comment").hide();
}else{
$("#attachment_table").show();
$("#add_comment").show();
}
return false;
});
});
$("#bz_show_bug_column_1").append($("#bz_show_bug_column_2").html());
$("#bz_show_bug_column_2").remove();
$("table.edit_form").css("width","auto").css("float","right").find("th").css("text-align","left");
$("#changeform").css("min-height","400px");
You can also change skins/standard/global.css to remove hyperlink underline, and change default font:
a {
text-decoration: none;
}
/* this already exists, just edit it */
body, td, th, input {
font-family: Verdana, sans-serif;
font-size: 11pt;
}
June 27, 2013
GOLANG SSL Server and Client example
https://gist.github.com/spikebike/2232102
Below is my simple static "SSL Proxy" that listens on port 8000, and connects to another machine 10.3.0.124:443, and the proxy logs traffic both ways on screen.
To generate key.pem and cert.pem, you can use openssl, or use go team's simple program included in go package: http://golang.org/src/pkg/crypto/tls/generate_cert.go
Below is my simple static "SSL Proxy" that listens on port 8000, and connects to another machine 10.3.0.124:443, and the proxy logs traffic both ways on screen.
To generate key.pem and cert.pem, you can use openssl, or use go team's simple program included in go package: http://golang.org/src/pkg/crypto/tls/generate_cert.go
package main
import (
"io"
"log"
"net"
"fmt"
"os"
"crypto/tls"
"crypto/rand"
)
func checkError(err error) {
if err != nil {
fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
os.Exit(1)
}
}
/* slower, by we can print/log everything */
func myrawcopy(dst,src net.Conn) (written int64, err error) {
buf := make([]byte, 32*1024)
for {
nr, er := src.Read(buf)
if nr > 0 {
fmt.Printf("%s",string(buf[0:nr]));
nw, ew := dst.Write(buf[0:nr])
if nw > 0 {
written += int64(nw)
}
if ew != nil {
err = ew
break
}
if nr != nw {
err = io.ErrShortWrite
break
}
}
if er == io.EOF {
break
}
if er != nil {
err = er
break
}
}
return written, err
}
func myiocopy(dst net.Conn, src net.Conn){
myrawcopy(dst, src)
//io.Copy(dst,src);
dst.Close();
src.Close();
}
func handleclient(c net.Conn){
config := tls.Config{InsecureSkipVerify: true}
conn, err := tls.Dial("tcp", "10.3.0.124:443", &config)
checkError(err)
go myiocopy(conn,c)
//io.Copy(c, conn)
myrawcopy(c, conn)
c.Close()
conn.Close();
}
func main() {
cert, err := tls.LoadX509KeyPair("cert.pem", "key.pem")
if err != nil {
log.Fatalf("server: loadkeys: %s", err)
}
config := tls.Config{Certificates: []tls.Certificate{cert}}
config.Rand = rand.Reader
service := "0.0.0.0:8000"
listener, err := tls.Listen("tcp", service, &config)
if err != nil {
log.Fatalf("server: listen: %s", err)
}
log.Printf("server: listening on %s for https, connects to https://10.3.0.124:443",service)
for {
conn, err := listener.Accept()
if err != nil {
log.Printf("server: accept: %s", err)
break
}
defer conn.Close()
log.Printf("server: accepted from %s", conn.RemoteAddr())
go handleclient(conn)
}
}
June 24, 2013
Free - Remote Desktop Control Software
To sum it up:
For business, Use LogMeIn for unattended, Join.me for attended.
For personal: Use TeamViewer.
|
I still very much believe that the features and speed of LogMeIn are unmet by any other product and worth the extra hassle if you have access to the other machine(s) or means to connect remotely and install it. It is free for personal and commercial use. |
|
|
|
|
|
|
June 7, 2013
To open a page in a frame using javascript
"javascript:top.frames['framename'].location = 'filename.html';return true;"
A list of SSL/HTTPS sniffer/proxy/dump
- mitmproxy, written in Python, includes a ncurse-based UI, or the console-based mitmdump. Able to generate SSL certs on the fly. http://mitmproxy.org/
- TCPCather: http://www.tcpcatcher.org/. Looks really good.
- sslsniff: by the famous hacker moxie0: https://github.com/moxie0/sslsniff
- burp (the free version): http://www.portswigger.net/burp/proxy.html
I personally used mitmproxy to my satisfaction.
June 6, 2013
vim regex search tips
1. $ < > does not need to be escaped.
2. [ ] & needs to be escaped
3. [a-zA-Z] sometimes can be better accepted than \a (for alphabet)
4. For replacement, & means the matched term
2. [ ] & needs to be escaped
3. [a-zA-Z] sometimes can be better accepted than \a (for alphabet)
4. For replacement, & means the matched term
May 9, 2013
hg serve multiple projects
To use "hg serve" to serve multiple project internally (with your LAN). Create a file named webconf (it can be any name) with the following content:
[collections]
repos/ = .
[extensions]
hgext.highlight=
[web]
allow_push = *
push_ssl = false
pygments_style = vs
style = gitweb
[collections]
repos/ = .
[extensions]
hgext.highlight=
[web]
allow_push = *
push_ssl = false
pygments_style = vs
style = gitweb
Then in system start up run this:
cd your_hg_directory && sudo -u your-name hg serve --web-conf ./webconf
I like the "gitweb" style because it gives you date on files. The default style is "paper". Other styles can be:
atom
coal
gitweb
monoblue
paper
raw
rss
spartan
May 8, 2013
shrew vpn masquerade on Linux
Once your have your VPN client running on a Linux box, sometimes you would like to share that link with that machines on your LAN (either physical LAN or virtual LAN such as Virtual Machines).
Because shrew uses the kernel IPsec VPN, the iptables masquerade rule does not work on the virtual tap0 interface. There does not seem to exist an easy fix.
The work around I have is to install a linux virtual machine (virtualbox) on the host, which has two NICs, one is NAT, the other one is bridging. Then run iptables masquerade on the virtual Linux, taking traffic from the bridged NIC, and send it out to the NATed NIC. On the host, since virtualbox behaves just like any other application, it is able to access all the VPNed network resources. Bingo!
It works well here. Let me know your thoughts.
Because shrew uses the kernel IPsec VPN, the iptables masquerade rule does not work on the virtual tap0 interface. There does not seem to exist an easy fix.
The work around I have is to install a linux virtual machine (virtualbox) on the host, which has two NICs, one is NAT, the other one is bridging. Then run iptables masquerade on the virtual Linux, taking traffic from the bridged NIC, and send it out to the NATed NIC. On the host, since virtualbox behaves just like any other application, it is able to access all the VPNed network resources. Bingo!
It works well here. Let me know your thoughts.
shrew vpn client on Linux for Cisco Concentrator
To talk to a Cisco VPN Concentrator, one can use "vpnc" or "shrew vpn client".
My vpnc only stays up for a few hours, while on Windows the Cisco VPN client can stay up for days. So I wanted to give shrew a try.
Shrew can import Cisco .pcf configuration file. After that, a connection entry is created. However, you probably will need to modify the profile for it to work. On the "qikea" window, right click on the profile, then "Modify", go to tab "Phase 2" and make your choices instead of auto. For example, try change PFS Group to "2". This worked for many people.
If you are interested, you can try to use the tool "ike-scan" to probe your vpn server and find out exactly the parameters for this tab.
That solved my problem.
The following screenshot is a Windows screenshot, but the Linux one is very similar.

I got the this tip from the following post:
http://www.rhyous.com/2009/10/29/windows-7-64-bit-vpn-client-shrewsoft/
My vpnc only stays up for a few hours, while on Windows the Cisco VPN client can stay up for days. So I wanted to give shrew a try.
Shrew can import Cisco .pcf configuration file. After that, a connection entry is created. However, you probably will need to modify the profile for it to work. On the "qikea" window, right click on the profile, then "Modify", go to tab "Phase 2" and make your choices instead of auto. For example, try change PFS Group to "2". This worked for many people.
If you are interested, you can try to use the tool "ike-scan" to probe your vpn server and find out exactly the parameters for this tab.
That solved my problem.
The following screenshot is a Windows screenshot, but the Linux one is very similar.
I got the this tip from the following post:
http://www.rhyous.com/2009/10/29/windows-7-64-bit-vpn-client-shrewsoft/
April 26, 2013
Text to ASCII Art
Under Linux, use the program "figlet" to turn regular text info a ASCII art text.
Example:
figlet hello
_ _ _
| |__ ___| | | ___
| '_ \ / _ \ | |/ _ \
| | | | __/ | | (_) |
|_| |_|\___|_|_|\___/
figlet -W hello (wide version)
_ _ _
| |__ ___ | | | | ___
| '_ \ / _ \ | | | | / _ \
| | | | | __/ | | | | | (_) |
|_| |_| \___| |_| |_| \___/
You can choose different style too:
figlet -f banner -W hello
# # ###### # # ####
# # # # # # #
###### ##### # # # #
# # # # # # #
# # # # # # #
# # ###### ###### ###### ####
figlet -f bubble -W hello
_ _ _ _ _
/ \ / \ / \ / \ / \
( h ) ( e ) ( l ) ( l ) ( o )
\_/ \_/ \_/ \_/ \_/
Example:
figlet hello
_ _ _
| |__ ___| | | ___
| '_ \ / _ \ | |/ _ \
| | | | __/ | | (_) |
|_| |_|\___|_|_|\___/
figlet -W hello (wide version)
_ _ _
| |__ ___ | | | | ___
| '_ \ / _ \ | | | | / _ \
| | | | | __/ | | | | | (_) |
|_| |_| \___| |_| |_| \___/
You can choose different style too:
figlet -f banner -W hello
# # ###### # # ####
# # # # # # #
###### ##### # # # #
# # # # # # #
# # # # # # #
# # ###### ###### ###### ####
figlet -f bubble -W hello
_ _ _ _ _
/ \ / \ / \ / \ / \
( h ) ( e ) ( l ) ( l ) ( o )
\_/ \_/ \_/ \_/ \_/
Use "figlist" to list all the styles.
April 10, 2013
Fix: vim indent not working
If you loaded a new indent file or syntax file under ~/.vim/ and it is not taking effect, make sure you have the following line in your ~/.vimrc file:
filetype plugin indent on
filetype plugin indent on
This turns on filetype detection, filetype plugin, and filetype-indent.
Subscribe to:
Posts (Atom)