1
Hacking web / XSS Libro
« en: Enero 22, 2012, 01:41:34 am »
Alguien conoce algun buen libro para principiantes para comenzar con el xss??
Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.
import java.io.*;
public class problema4 {
public static void main(String[] args)throws IOException
{
InputStreamReader isr = new InputStreamReader (System.in);
BufferedReader br = new BufferedReader (isr);
int i=0,j=0,len=0,rot = 0,cont,fila;
char last;
char local;
char arr[][] = new char[5][10];
String nom = " ";
//Carga la matriz de espacios en blancos para no tener tipo de dato null
for (i=0; i<5;i++)
for (j=0;j<10;j++)
arr[i][j] = ' ';
//Carga los valores de la matriz
for (i=0; i<5;i++)
{
//Proceso que realiza por cada fila
System.out.println("Inserte nombre");
nom = br.readLine();
len = nom.length();
for (j=0;j<10;j++)
{
//Proceso que realiza por cada columna
if (j<len)
{
arr[i][j]= nom.charAt(j);
}
}
}
//Imprime los nombres
for (i=0; i<5;i++)
{for (j=0;j<10;j++)
System.out.print (arr[i][j] + "\t");
System.out.println();
}
//rota los valores
System.out.println("Inserte la fila que desea modificar");
fila = Integer.parseInt(br.readLine());
System.out.println("Inserte la cantidad de veces que desea rotar la fila");
rot = Integer.parseInt(br.readLine());
cont = 0;
while (cont<rot)
{ last = arr[fila][9];
for (j=9;j>0;j--)
{
arr[fila][j] = arr[fila][j-1];
}
cont++;
arr[fila][0] = last;
}
//Imprime los nuevos nombres
for (i=0; i<5;i++)
{for (j=0;j<10;j++)
System.out.print (arr[i][j] + "\t");
System.out.println();
}
}
}
Btw. Hace tiempo que no posteaba nada
import javax.swing.JOptionPane;
class lib
{
String unidad (int uni)
{
String nom="";
switch (uni)
{
case 1: nom = "uno";break;
case 2: nom = "dos";break;
case 3: nom = "tres";break;
case 4: nom = "cuatro";break;
case 5: nom = "cinco";break;
case 6: nom = "seis";break;
case 7: nom = "siete";break;
case 8: nom = "ocho";break;
case 9: nom = "nueve";break;
}
return nom;
}
String inter (int ram)
{
String nom="";
switch (ram)
{
case 10: nom = "Diez";break;
case 11: nom = "Once";break;
case 12: nom = "Doce";break;
case 13: nom = "Trece";break;
case 14: nom = "Catorce";break;
case 15: nom = "Quince";break;
}
return nom;
}
String decena (int dec)
{
String nom="";
switch (dec)
{
case 1: nom = "Diez ";break;
case 2: nom = "Veinte ";break;
case 3: nom = "Treinta ";break;
case 4: nom = "Cuarenta ";break;
case 5: nom = "Cincuenta";break;
case 6: nom = "Sesenta ";break;
case 7: nom = "Setenta ";break;
case 8: nom = "Ochenta ";break;
case 9: nom = "Noventa ";break;
}
return nom;
}
}
class abc {
public static void main(String[] args)
{
int resp = 1;
do
{
switch (resp)
{
case 1:
int ram = (int) (Math.random()*100), uni, dec,tot;
String u,d,c,ramt;
uni = ram%10;
dec = (int)(ram/10);
ramt = Integer.toString(ram);
StringBuffer temp = new StringBuffer(ramt);
tot = temp.length();
lib obj = new lib();
if (tot==1)
{
u = obj.unidad(ram);
JOptionPane.showMessageDialog(null, "El numero " + ram + " en palabras es = " + u, "NUMERO",JOptionPane.PLAIN_MESSAGE);
}
if (tot ==2)
{
if (ram>9&&ram<16)
{
u = obj.inter(ram);
JOptionPane.showMessageDialog(null, "El numero " + ram + " en palabras es = " + u, "NUMERO",JOptionPane.PLAIN_MESSAGE);
}
else
{
u = obj.unidad(uni);
d = obj.decena(dec);
if (ram%10!=0)
{
c = d + " y " + u;
}
else
{
c = d;
}
JOptionPane.showMessageDialog(null, "El numero " + ram + " en palabras es = " + c, "NUMERO",JOptionPane.PLAIN_MESSAGE);
}
}
break;
case 2: resp =2;break;
default: JOptionPane.showMessageDialog(null, "Opcion No valida \n Intente de nuevo", "ERROR", JOptionPane.ERROR_MESSAGE);
}
resp=Integer.parseInt(JOptionPane.showInputDialog(null, "1. Repetir el programa \n 2. SALIR", "SELECCIONE",JOptionPane.QUESTION_MESSAGE));
}while (resp!=2);
}
}
import javax.swing.JOptionPane;
class lib
{
int ram;
lib ()
{
ram = (int) (Math.random()*100);
System.out.println (ram);
}
void presentacion()
{
JOptionPane.showMessageDialog(null, "UNIVERSIDAD TECNOLÓGICA DE PANAMÁ" +
"\nFACULTAD DE INGENIERÍA DE SISTEMAS COMPUTACIONALES" +
"\n DE Sistemas y Computación" +
"\nCARRERA Licenciatura en ingeniería de Sistemas y Computación " +
"\nDesarrollo de Software I" +
"\nPERTENECE A: José Javier Cruz Torres" +
"\nCÉDULA: 8-876-83" +
"\nFACILITADORA: ROSA DUTARI DE SAMANIEGO " +
"\nSEMESTRE II" +
"\nSEDE PANAMA , AÑO 2011", "Presentacion", JOptionPane.PLAIN_MESSAGE);
}
void prin (String nom)
{
int lec1;
int cont = 0;
String val;
JOptionPane.showMessageDialog(null, "Hola " + nom + " " + "Bienvenido a \n ADIVINA EL NUMERO", "Hola :D", JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null, nom + " Las reglas son sencillas \n Pensare un numero del 1 al 100 \n y tu lo tendras que adivinar en 10 intentos\n De Acuerdo", "Reglas", JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null, "GAME ON ", "GAME ON", JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null, "Estoy pensando \n ................ ", "Thinking ....", JOptionPane.PLAIN_MESSAGE);
lec1 = Integer.parseInt(JOptionPane.showInputDialog(null, "Ya pense en el numero \n Cual numero crees que es??? ", "Listo...", JOptionPane.PLAIN_MESSAGE));
if (validator(lec1) == true )
{
JOptionPane.showMessageDialog(null, "FELICIDADES HAS GANADO SIN FALLAR", " Felicidades", JOptionPane.PLAIN_MESSAGE);
}
else
{
while (cont != 10)
{
if (cont >=5)
{
lec1 = Integer.parseInt(JOptionPane.showInputDialog(null, "Cual numero crees que es??? ", "ADIVINA", JOptionPane.PLAIN_MESSAGE));
if (cont==5)
{
JOptionPane.showMessageDialog(null, "De verdad?? \n Eres malisimo dude xD \n no mentira sigue intentando \n Apartir de aqui te ayudo \n\t\t Si?? :D ", "NECESITAS AYUDA xD", JOptionPane.ERROR_MESSAGE);
}
if (cont > 5)
{
if (ram > lec1)
{
JOptionPane.showMessageDialog(null, "El numero que escribiste es menor que el numero que deseas adivinar", " ADIVINA", JOptionPane.QUESTION_MESSAGE);
JOptionPane.showMessageDialog(null, "Te has equivocado, llevas" + cont + " intentos", " Fallaste :X", JOptionPane.ERROR_MESSAGE);
}
if (ram < lec1)
{
JOptionPane.showMessageDialog(null, "El numero que escribiste es mayor que el numero que deseas adivinar", " ADIVINA", JOptionPane.QUESTION_MESSAGE);
JOptionPane.showMessageDialog(null, "Te has equivocado, llevas" + cont + " intentos", " Fallaste :X", JOptionPane.ERROR_MESSAGE);
}
}
}
cont = cont + 1;
if (cont >= 1 && cont< 5)
{ if (cont > 1)
{
lec1 = Integer.parseInt(JOptionPane.showInputDialog(null, "Cual numero crees que es??? ", "ADIVINA", JOptionPane.PLAIN_MESSAGE));
}
JOptionPane.showMessageDialog(null, "Te has equivocado, llevas" + cont + " intentos", " Fallaste :X", JOptionPane.ERROR_MESSAGE);
}
if (validator(lec1)==true)
{
JOptionPane.showMessageDialog(null, "FELICIDADES HAS GANADO EN " + cont +" intentos" , " Felicidades", JOptionPane.PLAIN_MESSAGE);
cont = 10; //Finalizador del ciclo
}
if (cont == 10 && validator(lec1)!= true)
{
JOptionPane.showMessageDialog(null, "Has Perdido ", " PERDISTE D=", JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null, "El numero era el " + ram, " PERDISTE D=", JOptionPane.PLAIN_MESSAGE);
}
}
}
}
boolean validator (int lec1)
{
boolean resp;
if (lec1 == ram)
{
resp = true;
}
else
{
resp = false;
}
return resp;
}
}
class gameon
{
public static void main(String[] args)
{ String nom;
int sel1, ram;
lib obj = new lib();
nom = JOptionPane.showInputDialog(null, "Por Favor Inserte su nombre", "Bienvenido",JOptionPane.QUESTION_MESSAGE);
do
{
sel1 = Integer.parseInt(JOptionPane.showInputDialog(null, "Bievenido " + nom + " Elige una de las opciones a realizar \n 1. Presentacion \n 2. Juego \n 3. Salir " , "Selecciona",JOptionPane.QUESTION_MESSAGE));
switch (sel1)
{
case 1: obj.presentacion (); break;
case 2: obj.prin (nom); break;
case 3: sel1 = 3;break;
default: System.out.println ("Opcion no valida"); break;
}
} while (sel1 != 3);
}
}
El programa fue hecho y compilado en JCreator
#!/usr/bin/python3.2
import curses,random,time
class Rain(object):
'''
Screen usage class.
'''
def __init__(self):
self.objects = [] # Will contain the list of all objects falling on the screen
def start(self):
'''
Lauches curses process and define basics attributes for the class
'''
self.xCornerUL = 0
self.yCornerUL = 0
self.window = curses.initscr() # initialize the curses working area (full terminal)
curses.curs_set(0) # hide cursor
curses.start_color() # start using colors
curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK) # Green on Black
self.xCornerLR = self.window.getmaxyx()[1] -1 # Lower-Right corner
self.yCornerLR = self.window.getmaxyx()[0] -1 # X and Y
def stop(self):
'''
Stops curses process
'''
curses.endwin()
def addChar(self,ch,x=0,y=0,options=0):
'''
Print the give character (ascii), in the curses matrix, for give x and y values
'''
intCh = ord(ch)
self.window.addch(y,x,intCh,options)
def apply(self):
'''
Display the screen
'''
self.window.refresh()
def cls(self):
'''
Clear the screen
'''
self.window.clear()
def startGoutte(self,length=8):
'''
Initialise a new object
'''
startX = random.randint(self.xCornerUL,self.xCornerLR) # random X position
speed = random.randint(5,10) # random falling speed (1 is faster, max 100)
newGoutte = Goutte(length,speed) # Create the new object
self.objects.append(newGoutte) # Add object to the list
newGoutte.start(startX, self.yCornerUL) # Starts the object
def draw(self):
'''
Updates the screen matrix, sets chars and colors.
'''
# Making a 'blank' screen, clearscreen is faster but makes the display blinking (ugly!)
for y in range(self.yCornerUL,self.yCornerLR):
for x in range(self.xCornerUL,self.xCornerLR):
self.addChar(" ", x, y)
# Draw each object on screen
for goutte in self.objects:
for py in range(self.yCornerUL,self.yCornerLR):
if py in goutte.points.keys():
first = max(goutte.points.keys())
second = first - 1
last = min(goutte.points.keys())
if py == first: # The lowest element (the first of the object) is the brightest
self.window.attron(curses.A_BOLD)
self.addChar(goutte.points[py], goutte.x, py)
self.window.attroff(curses.A_BOLD)
elif py == second: # Some emphasis for the second element
self.window.attron(curses.A_BOLD)
self.addChar(goutte.points[py], goutte.x, py,curses.color_pair(goutte.color))
self.window.attroff(curses.A_BOLD)
else: # Standard display for the rest
self.addChar(goutte.points[py], goutte.x, py,curses.color_pair(goutte.color))
self.apply()
def run(self):
'''
Main object method ... the real engine of the screen.
'''
self.start() # Starts working
while 1:
if len(self.objects) > 0: # If something to display ...
for goutte in self.objects:
if min(goutte.points.keys()) <= self.yCornerLR: # If the object isn't below the display area, let's move it down
goutte.down()
else:
self.objects.remove(goutte) # The object is under the screen, remove it
goutte.stop()
test = random.randint(1,10) # Random number... will there be a new object ?
if test > 8: # roughly 20% to get a new object
lmax = self.yCornerLR - self.yCornerUL -2 # Max length of the object
lmin = lmax//2 # Min length of the object
lgoutte = random.randint(lmin,lmax) # Length of the object between lmin and lmax
self.startGoutte(lgoutte) # Create the object
self.draw() # Let's make the matrix
time.sleep(0.02) # Wait a bit before next iteration
self.stop()
class Goutte(object):
'''
Defines the moving object
'''
def __init__(self,length=8,speed=100):
self.length = length
self.allchars = "abcdefghijklmnopqrstuvwxyz0123456789" # All chard that can be used to draw the object
self.speed = speed
self.points = {} # Will contain all 'points' of the object
self.loop = 0 # state of the object
self.color = 1 # color (cannot be anything else at this time)
def setchar(self):
return self.allchars[random.randint(0,len(self.allchars)-1)] # get randomchar from self.allchars
def start(self,x,y):
self.x = x
self.starty = y
self.posy = y
self.char = self.setchar()
# Defines all characters of the object
for a in range(0,self.length):
py = y - a
self.points[py] = self.setchar()
def down(self):
'''
Used to move the object downward
'''
test = self.loop/self.speed # If test == 1 => let's move
if test == 1:
self.posy = self.posy + 1
newdic = {}
for py in self.points:
newpy = py + 1
newdic[newpy] = self.setchar()
self.points = newdic
self.loop = 0
self.loop = self.loop + 1
def stop(self):
'''
Delete all attached attributes, faster garbage collection ? (not sure if it works in any way)
'''
del self.allchars
del self.x
del self.starty
del self.posy
del self.char
del self.points
del self.loop
del self.speed
# MAIN PROGRAM
screen = Rain()
screen.run()
screen.stop()
def sequence (i):
n = 1
a = 0
b = 1
c = 0
while n<=i:
if n==1:
print "0",
n = n + 1
elif n==2:
print "1",
n = n + 1
else:
c = a + b
a = b
b = c
print c,
n = n + 1
continue
r = str("Y")
while (r == "y")or(r=="Y"):
i = input("Insert the quantity of numbers that you like to print ")
sequence(i)
print ""
r = raw_input("You wanna insert another number Y/N ")
#!/usr/bin/env python
def primo (a):
b = 1
c = 0
while a!=b:
if (a%b)==0:
c = c + 1
else:
c = c + 0
b = b + 1
if c>1:
return False
else:
return True
r = str("y")
while (r == "y")or(r == "Y"):
a = int(input("Insert a positive number "))
c = 1
while a>=c:
d = primo(c)
if d==True:
print c,'\t',
c = c + 1
continue
print ""
r = str(raw_input("You wanna insert another number Y/N "))
print ("\t\t ****Made By Xpect****")
print (" ")
print ("Elija la opcion que desea realizar")
print ("1. Magnitud de un vector")
print ("2. Producto punto")
print ("3. Proyeccion escalar del segundo vector sobre el primer vector")
print ("4. Proyeccion vectorial del segundo vector sobre el primer vector")
print (" ")
r = int(input("Inserte numero de opcion "))
if (r==1):
print ("Inserte los valores de x, y , z")
x = input("x = ")
y = input("y = ")
z = input("z = ")
resp = str("La magnitud es: ")
magni =((x*x) + (y*y) + (z*z))**(0.5)
print resp,'\t', magni
l = raw_input()
elif (r==2):
print ("Inserte los valores de x, y , z del primer vector")
x1 = input("x = ")
y1 = input("y = ")
z1 = input("z = ")
print ("Inserte los valores de x, y , z del segundo vector")
x2 = input("x = ")
y2 = input("y = ")
z2 = input("z = ")
pto = (x1*x2) + (y1*y2) + (z1*z2)
resp = str("El producto punto es: ")
print resp,'\t', pto
l = raw_input()
elif (r==3):
print ("Inserte los valores de x, y , z del primer vector")
x1 = input("x = ")
y1 = input("y = ")
z1 = input("z = ")
print ("Inserte los valores de x, y , z del segundo vector")
x2 = input("x = ")
y2 = input("y = ")
z2 = input("z = ")
proye = (float((x1*x2) + (y1*y2) + (z1*z2)))/(float (((x1*x1) + (y1*y1) + (z1*z1))**(0.5)))
resp = str("La proyeccion escalar es: ")
print resp,'\t', proye
l = raw_input()
elif (r==4):
print ("Inserte los valores de x, y , z del primer vector")
x1 = input("x = ")
y1 = input("y = ")
z1 = input("z = ")
print ("Inserte los valores de x, y , z del segundo vector")
x2 = input("x = ")
y2 = input("y = ")
z2 = input("z = ")
proyv = float((x1*x2) + (y1*y2) + (z1*z2))/float((x1*x1) + (y1*y1) + (z1*z1))
x = float(x1 * proyv)
y = float(y1 * proyv)
z = float(z1 * proyv)
print "Vector ", " < " , x , " , " , y , "," , z , "> "
l = raw_input()
Este es un modelo de como queria que fuera el programa. Despues le añadire mas opciones a realizar .