elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
29 Mayo 2012, 09:20  


Tema destacado: Personaliza-Escoge el diseño del foro que más te guste.

+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting (Moderadores: Novlucker, Leo Gutiérrez., EleKtro H@cker)
| | |-+  Poner contraseña a documento en script
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Poner contraseña a documento en script  (Leído 687 veces)
bastbeat

Desconectado Desconectado

Mensajes: 4


Ver Perfil
Poner contraseña a documento en script
« en: 10 Noviembre 2011, 20:38 »

Buenas, estoy empezando en esto, y estso dearrollando un script basico...
necesito que me digais como pongo contraseña a un documento, ya lo e intentado con "gpg", pero no me ha ido. Aqui os lo dejo

Código
#!/bin/bash
read -p "Ingresa opcion a: " opcion
read -p "Ingresa opcion b: " opcionb
if [ "$opcion" = "$opcionb" ]; then
if [ ! -d /root/Escritorio/Resultados ]; then
mkdir /root/Escritorio/Resultados
touch /root/Escritorio/Resultados/resultado
echo las variables son iguales >> /root/Escritorio/Resultados/resultado
else
touch /root/Escritorio/Resultados/resultado
echo las variables son iguales >> /root/Escritorio/Resultados/resultado
fi
elif [ ! "$opcion" = "$opcionb" ];then
if [ ! -d /root/Escritorio/Resultados ]; then
mkdir /root/Escritorio/Resultados
touch /root/Escritorio/Resultados/resultado
echo las variables no son iguales >> /root/Escritorio/Resultados/resultado
else
touch /root/Escritorio/Resultados/resultado
echo las variables no son iguales >> /root/Escritorio/Resultados/resultado
fi
fi
read -p "Desea poner contraseña al archivo resultado?: " respuesta
if [ "$respuesta" = si ]; then
gpg -c /root/Escritorio/Resultados/resultados.txt
if [ "$respuesta" = no ]; then
fi
fi
exit 0


« Última modificación: 11 Noviembre 2011, 03:02 por Leo Gutiérrez. » En línea
Leo Gutiérrez.
. . .. ... ..... ........ ............. .....................
Moderador
***
Desconectado Desconectado

Mensajes: 2.968


/^$/


Ver Perfil WWW
Re: Poner contraseña a documento en script
« Respuesta #1 en: 11 Noviembre 2011, 03:08 »

La manera de usar gpg es:

gpg -c archivo

Ejemplo:

Código:
[0 [19:04][leo@archero Desktop]$ cat file.txt
url1
url2
url3
url4

[0 [19:04][leo@archero Desktop]$ gpg -c file.txt
gpg: directory `/home/leo/.gnupg' created
gpg: new configuration file `/home/leo/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/leo/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/leo/.gnupg/pubring.gpg' created
[0 [19:04][leo@archero Desktop]$ cat file.txt
file.txt      file.txt.gpg 
[0 [19:04][leo@archero Desktop]$ cat file.txt.gpg
���+���`�-9�����B�U���{[|-�Lzcz:̨��%N�m�S�pRL����][0 [19:05][leo@archero Desktop]$
[0 [19:05][leo@archero Desktop]$

Ahora si quieres descifrar dicho archivo:
gpg archivo.gpg

Ejemplo
Código:
[0 [19:05][leo@archero Desktop]$ gpg file.txt.gpg
gpg: keyring `/home/leo/.gnupg/secring.gpg' created
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
File `file.txt' exists. Overwrite? (y/N) y
gpg: WARNING: message was not integrity protected
[0 [19:05][leo@archero Desktop]$


En línea

Código
(( 1 / 0 )) &> /dev/null || {
echo -e "stderrrrrrrrrrrrrrrrrrr";
}
 

leorocko13@hotmail.com
https://github.com/leogtzr/
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Poner script de subida
Desarrollo Web
BaD-GirL 12 2,158 Último mensaje 6 Mayo 2004, 23:52
por BaD-GirL
Poner @ delante de un script
Desarrollo Web
YeKTa 4 364 Último mensaje 27 Septiembre 2006, 21:45
por YeKTa
Pasra Varibles en el mismo documento php con java script
PHP
David Vans 3 643 Último mensaje 21 Septiembre 2007, 18:20
por alone-in-the-chat
Script para poner una contraseña a una carpeta en XP « 1 2 »
Scripting
maxi_kpo13 15 3,974 Último mensaje 9 Junio 2010, 20:02
por APOKLIPTICO
¿¿¿Como abrir un documento .docx, teniendo este contraseña ???
Criptografía
El Duende Oloroso 1 3,162 Último mensaje 22 Enero 2011, 17:50
por APOKLIPTICO
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines