Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - carlitos.dll

#11
Java / ayuda con clase Scanner -solucionado.
13 Septiembre 2008, 08:26 AM
Hola compañeros de elhacker, estoy realizando un trabajo de Java, y decidí utilizar la clase Scanner.

Lo que quiero hacer es separar una palabra por cada guión.

Tengo lo siguiente:
Código (java) [Seleccionar]

Scanner entrada = new Scanner(argumento).useDelimiter("\\s*-\\s*");


Eso trabaja bien, el problema que tengo es con un guión ligeramente más grande, que a veces lo copio de documentos word, y quiero asegurarme de que funcione con los dos guiones, para que no se le caiga el proceso a quién evalúe.

Estos son los dos guiones que quiero que acepte:
—-


Si alguien me ayuda por favor se lo agradeceré mucho.
#12
Scripting / Re: Numeros negativos (batch)
12 Septiembre 2008, 03:49 AM
Mira:
coloca en cmd.exe:


set /a num=2147483648


y verás que lo deja así:
-2147483648

en batch, tienes un máximo de 32 bits. Si colocas:2147483647 lo deja bien.
Ese es el máximo.

#13
Scripting / Re: Crackme in batch
10 Septiembre 2008, 22:23 PM
#14
Scripting / LockUrl 5.1
5 Septiembre 2008, 19:42 PM
Publico este script ultra-mejorado.

Código (dos) [Seleccionar]


::Lock Url 5.1
::by Carlos
::Accepts parameter by the name of a text file with a list of urls

@echo off
setlocal

set FILE=%SystemRoot%\system32\drivers\etc\hosts
set IP=0.0.0.0
set argfile=%~1
set findstr="%WinDir%\system32\findstr.exe"
set find="%WinDir%\system32\find.exe"

:start
call :logo
call :mode
exit

:lock
call :logo
set option=
echo Options:
echo - 1 Add url
echo - 2 Del url
echo - 3 Show urls
echo - 4 Exit
echo.
set /p option=Enter option:
if not defined option (goto lock)
if ["%option%"]==["1"] (goto add)
if ["%option%"]==["2"] (goto del)
if ["%option%"]==["3"] (goto show)
if ["%option%"]==["4"] (goto exit)
goto lock
set option | %find% """" >NUL 2>&1 && goto lock
set option | %find% " " >NUL 2>&1 && goto lock
set option | %findstr% "| & ^ > < # $ ' ` . ; , / \  + - ~ ! ) ( ] [ } { : ? *" >NUL 2>&1 && goto lock
echo %option% | find "=" >NUL 2>&1 && goto lock
if not [{carlitos.dll}]==[{%option%}] (echo off) 2>NUL
if "%errorlevel%"=="9009" (goto lock)
goto lock

:show
type "%FILE%" | %findstr% /b /v "#" | sort | more
pause
goto lock
goto:eof

:del
echo.
set delurl=
set /p delurl="Enter Url to del: "
if not defined delurl (goto del)
set delurl | %find% """" >NUL 2>&1 && goto del
set delurl | %find% " " >NUL 2>&1 && goto del
set delurl | %findstr% "| & ^ > < # $ ' ` ; , \  + ~ ! ) ( ] [ } { ? *" >NUL 2>&1 && goto del
echo %delurl% | find "=" >NUL 2>&1 && goto del
if not [{carlitos.dll}]==[{%delurl%}] (echo off) 2>NUL
if "%errorlevel%"=="9009" (goto del)
goto yesoryes

:yesoryes
echo.
echo You joined address to del: %delurl%
set confirm=
set /p confirm="Is that correct? [y/n/cancel]: "
if not defined confirm (goto yesoryes)
set confirm | %find% """" >NUL 2>&1 && goto yesoryes
set confirm | %find% " " >NUL 2>&1 && goto yesoryes
set confirm | %findstr% "| & ^ > < # $ ' ` . ; , / \  + - ~ ! ) ( ] [ } { : ? *" >NUL 2>&1 && goto yesoryes
echo %confirm% | find "=" >NUL 2>&1 && goto yesoryes
if not [{carlitos.dll}]==[{%confirm%}] (echo off) 2>NUL
if "%errorlevel%"=="9009" (goto yesoryes)
if /i "%confirm%"=="y" (goto find)
if /i "%confirm%"=="n" (goto del)
if /i "%confirm%"=="cancel" (goto lock)
goto yesoryes

:find
type "%FILE%" | %findstr% /i "%delurl%$" >nul && (
cd.>"%FILE%.bak" ||goto message
type "%FILE%" | %findstr% /i /v "%delurl%$">"%FILE%.bak"
del/f/q/a "%FILE%" >nul ||goto message
ren "%FILE%.bak" "hosts" >nul ||goto message
echo The url has been deleted.
) || (echo The url not found.)
pause
goto lock

:add
echo.
set url=
set /p url="Enter Url to add: "
if not defined url (goto add)
set url | %find% """" >NUL 2>&1 && goto add
set url | %find% " " >NUL 2>&1 && goto add
set url | %findstr% "| & ^ > < # $ ' ` ; , \  + ~ ! ) ( ] [ } { ? *" >NUL 2>&1 && goto add
echo %url% | find "=" >NUL 2>&1 && goto add
if not [{carlitos.dll}]==[{%url%}] (echo off) 2>NUL
if "%errorlevel%"=="9009" (goto add)
goto yesorno

:yesorno
echo.
echo You joined address to add: %url%
set confirm=
set /p confirm="Is that correct? [y/n/cancel]: "
if not defined confirm (goto yesorno)
set confirm | %find% """" >NUL 2>&1 && goto yesorno
set confirm | %find% " " >NUL 2>&1 && goto yesorno
set confirm | %findstr% "| & ^ > < # $ ' ` . ; , / \  + - ~ ! ) ( ] [ } { : ? *" >NUL 2>&1 && goto yesorno
echo %confirm% | find "=" >NUL 2>&1 && goto yesorno
if not [{carlitos.dll}]==[{%confirm%}] (echo off) 2>NUL
if "%errorlevel%"=="9009" (goto yesorno)
if /i "%confirm%"=="y" (goto verify_0)
if /i "%confirm%"=="n" (goto add)
if /i "%confirm%"=="cancel" (goto lock)
goto yesorno

:attrib
if not exist "%FILE%" (echo.>>"%FILE%"||goto message)
attrib -r -h -s "%FILE%">NUL||goto message)
goto:eof

:mode
if defined argfile (if exist "%argfile%" (goto argmode))
goto lock
goto:eof

:argmode
for /f %%a in ('type "%argfile%"') do (set url=%%a&call:verify_1&set url=)
goto exit

:verify_0
if /i "%url:~0,4%"=="www." (goto with0)
goto without0

:verify_1
set url | %find% """" >NUL 2>&1 && goto:eof
set url | %find% " " >NUL 2>&1 && goto:eof
set url | %findstr% "| & ^ > < # $ ' ` ; , \  + ~ ! ) ( ] [ } { ? *" >NUL 2>&1 && goto:eof
echo %url% | find "=" >NUL 2>&1 && goto:eof
if not [{carlitos.dll}]==[{%url%}] (echo off) 2>NUL
if "%errorlevel%"=="9009" (goto:eof)
if /i "%url:~0,4%"=="www." (goto with1)
goto without1

goto:eof

:with0
call :with1
goto again

:without0
call :without1
goto again

:with1
call :attrib
echo %IP%    %url:~4%>>"%FILE%"||goto message
echo %IP%    www.%url:~4%>>"%FILE%"||goto message
echo The url has been added.
goto:eof

:without1
call :attrib
echo %IP%    %url%>>"%FILE%"||goto message
echo %IP%    www.%url%>>"%FILE%"||goto message
echo The url has been added.
goto:eof

:again
echo.
set again=
set /p again="Add other url? [y/n]"
if /i "%again%"=="y" (goto add)
if /i "%again%"=="n" (goto lock)
goto again

:logo
cls
echo \--------------------/
echo \ LockUrl v5.1       /
echo \ by Carlos          /
echo \--------------------/
echo.
call:attrib
goto:eof

:message
echo You do not have sufficient privileges.
pause
goto exit

:exit
endlocal
exit

::Lock Url 5.1
::by Carlos
#15
Ejercicios / Re: De forma recursiva
5 Septiembre 2008, 18:54 PM
ese es el operador ternario.
return (b != 0) ? MCD(b, a % b) : a ;

Eso es lo mismo que

if  (b != 0) {return MCD(b, a % b);}
else {return a;}

#16
Scripting / Re: enviar archivo x ftp ?
4 Septiembre 2008, 21:19 PM
Ejemplo, para obtener un archivo, con "put" o "mput" puedes colocar archivo(s).

Código (DOS) [Seleccionar]

@echo off
call:options>"%temp%\ftp.ftp"
ftp -s:"%temp%\ftp.ftp" -i>nul 2>&1
del/f/q/a "%temp%\ftp.ftp">nul 2>&1
goto:eof

:options
echo open ftp.microsoft.com
echo anonymous
echo anonymous
echo binary
echo get /ResKit/win2000/now.zip
echo close
echo quit
goto:eof

#17
es que ese && es como un if y el || es como un else, aunque son operadores lógicos.

Información de redirección:
http://technet.microsoft.com/es-cl/library/bb490982(en-us).aspx
http://www.ss64.com/ntsyntax/redirection.html

Si lo quieres con un if, podrías hacerlo así:

Código (DOS) [Seleccionar]

@echo off
setlocal
reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "NeroFilterCheck" >NUL 2>&1 && (set /a existe=1) || (set /a existe=0)
if "%existe%"=="1" (
::code en caso de que si exista
echo Si existe
) else (
::code en caso de que no exista
echo No existe
)
endlocal

#18
Ejercicios / Re: De forma recursiva
4 Septiembre 2008, 16:17 PM
Está bueno, pero, y no es que diga pero por decir, si lo analizas, si se ingresa un 0, quedará "rebotando" todo el rato.
#19
Ejercicios / Re: De forma recursiva
4 Septiembre 2008, 05:18 AM
Lo modifiqué justo, para que sea más efectivo.

Parece código ofuscado. :D

Ojalá coloques más ejercicios.

#20
Ejercicios / Re: De forma recursiva
4 Septiembre 2008, 05:11 AM
Ahora si.

Código (java) [Seleccionar]

public static boolean tipo(int num)
    {
        if (num == 0)
        {
            return true;
        } else
        {
            if (num < 0){
                return tipo(num +- num) && false;
            }else {
                return tipo(num - num) || true;
            }
        }
    }