More strict ownership asserts
[mirrors/Programs.git] / php / skripty / bruteForcer.php
... / ...
CommitLineData
1<?php\r
2\r
3//CHAR AT POSITION "X"\r
4function charAt($str, $pos) {\r
5\r
6$pos = ($pos - 1); //Offset\r
7return (substr($str, $pos, 1)) ? substr($str, $pos, 1) : -1;\r
8\r
9}\r
10\r
11//NEXT CHARACTER\r
12function nextChar ( $in ) {\r
13\r
14$chars = ("abcdefghijklmnopqrstuvwxyz "); // Ends with space\r
15//echo(charAt($chars, 7)); //Debug\r
16$len = (strlen($chars));\r
17\r
18$char = $in;\r
19\r
20$charpos = ( strpos($chars, $char) );\r
21$newcharpos = ($charpos + 1);\r
22$char = $chars[$newcharpos];\r
23\r
24$out = $char;\r
25return ($out); //Returns "" after last character.\r
26\r
27}\r
28\r
29//BRUTE FORCER\r
30function bruteForce ( $word ) {\r
31\r
32$first = ("a");\r
33$prelast = ("z");\r
34$last = (" ");\r
35\r
36$wpos = 0;\r
37\r
38while ( $word[$wpos] == $prelast ) {\r
39 $wpos = ($wpos + 1);\r
40}\r
41\r
42$word[$wpos] = nextChar($word[$wpos]);\r
43\r
44/*\r
45while ( $word[$wpos] != $prelast ) {\r
46 $word[$wpos] = nextChar($word[$wpos]);\r
47 if ( $word[$wpos] == $last ) {\r
48 $word[$wpos] = $prelast;\r
49 }\r
50}\r
51*/\r
52\r
53return $word;\r
54}\r
55\r
56\r
57\r
58//===CODE===\r
59\r
60//$test = ("nazdar");\r
61//echo ($test["2"]);\r
62//die();\r
63\r
64echo(nextChar ("d") . "\n");\r
65echo(bruteForce ("ahoj") . "\n----------------------\n\n");\r
66\r
67$ted = ("a");\r
68while (1) {\r
69echo($ted."\n");\r
70$ted = bruteForce($ted);\r
71}\r
72\r
73/*\r
74$hash = ("79c2b46ce2594ecbcb5b73e928345492");\r
75$pass = ("ahoj");\r
76//echo(md5("ahoj"));\r
77\r
78$loop = 1;\r
79while($loop) {\r
80\r
81$now = $pass;\r
82\r
83 if ( md5($now) == $hash ) {\r
84 die ("Hash: $hash\nVysledek: $now\n");\r
85 }\r
86\r
87}\r
88*/\r
89\r
90?>\r
This page took 0.271228 seconds and 4 git commands to generate.