{"id":1813,"date":"2014-10-30T13:19:00","date_gmt":"2014-10-30T19:19:00","guid":{"rendered":"http:\/\/linuxitos.com\/main\/script-para-espiar-el-contenido-de-dispositivos-usb-y-copiarlo-a-la-pc\/"},"modified":"2019-12-04T14:39:12","modified_gmt":"2019-12-04T20:39:12","slug":"script-para-espiar-el-contenido-de-dispositivos-usb-y-copiarlo-a-la-pc","status":"publish","type":"post","link":"https:\/\/linuxitos.com\/main\/script-para-espiar-el-contenido-de-dispositivos-usb-y-copiarlo-a-la-pc\/","title":{"rendered":"Script para espiar el contenido de dispositivos USB y copiarlo a la PC"},"content":{"rendered":"<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; text-align: justify;\"><a style=\"background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: 0px 0px; background-repeat: initial; background-size: initial; border-bottom-color: rgba(0, 0, 0, 0.0980392); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #428bca; cursor: url('http:\/\/blog.desdelinux.net\/wp-content\/plugins\/image-zoom\/img\/zoomin.cur'), pointer; text-decoration: none;\" href=\"http:\/\/blog.desdelinux.net\/wp-content\/uploads\/2012\/12\/usb-spy-eyes_big.png?134903\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-16625\" style=\"border: 0px; box-shadow: #444444 0px 1px 2px; box-sizing: border-box; display: block; height: auto; margin-left: auto; margin-right: auto; max-width: 100%; vertical-align: middle;\" title=\"usb-spy-eyes_big\" src=\"http:\/\/blog.desdelinux.net\/wp-content\/uploads\/2012\/12\/usb-spy-eyes_big.png?134903\" alt=\"\" width=\"600\" height=\"350\" \/><\/a><br \/>\nHace poco quer\u00eda un escritp en bash que me indicara cuando la carga de la bateria de mi laptop estuviera llena, no tuve mucha suerte con la b\u00fasqueda, sin embargo encontr\u00e9 un escritp en bash que realiza las siguientes \u00a0funciones:<\/div>\n<ol style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 10px; margin-top: 0px; padding: 0px 0px 0px 40px; text-align: justify;\">\n<li style=\"box-sizing: border-box;\">Detectar cuando se conecta un dispositivo USB a la computadora<\/li>\n<li style=\"box-sizing: border-box;\">Copiar todo el contenido de ese dispositivo hacia la computadora<\/li>\n<\/ol>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; text-align: justify;\">B\u00e1sicamente con esas funciones podemos hacer un sin fin de cosas:<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; text-align: justify;\"><\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px;\"><span style=\"text-align: justify;\">Descripci\u00f3n de los archivos y lo que hace:<\/span><\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 30px; text-align: justify;\"><span style=\"box-sizing: border-box; font-weight: bold;\">1.<\/span>\u00a0Crear la carpeta \/home\/.USBDRIVES\/<br \/>\n<span style=\"box-sizing: border-box; font-weight: bold;\">2.<\/span>\u00a0Comprobar cada 5 segundos si hay alg\u00fan dispositivo USB (o CD\/DVD) conectado al ordenador.<br \/>\n<span style=\"box-sizing: border-box; font-weight: bold;\">3.<\/span>\u00a0En caso de que est\u00e9 alguno conectado, crear\u00e1 una carpeta dentro de \/home\/.USBDRIVES\/ con el nombre del USB (<em style=\"box-sizing: border-box;\">por ejemplo: memoria-2gb<\/em>) y adem\u00e1s, copiar\u00e1 todos los archivos .doc, .pdf, etc.,\u00a0hacia esta carpeta que reci\u00e9n acaba de crear.<br \/>\n<span style=\"box-sizing: border-box; font-weight: bold;\">4.<\/span>\u00a0En caso de que no haya ning\u00fan USB conectado, simplemente esperar\u00e1 5 para volver a verificar.<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px;\">\n<div style=\"text-align: justify;\">El script en bash y los archivos que son copiados lo pueden descargar desde <a href=\"https:\/\/mega.nz\/#!gIQTUSRJ!qhbVgRHHCTgD7L25CEKisqDQn5Jvm_AL0qAaVdoWBRg\" target=\"_blank\" rel=\"noopener noreferrer\">aqu\u00ed<\/a><\/div>\n<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; text-align: center;\"><\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px;\"><\/div>\n<div style=\"background: url('http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/alert.png') 7px 50% no-repeat #f2dede; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid #eed3d7; box-sizing: border-box; color: #902323; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 14px; line-height: 22.5px; margin: 15px; padding: 10px 10px 10px 45px;\">\n<div style=\"text-align: justify;\"><span style=\"color: red; font-family: Verdana, sans-serif;\">El script debe ser ejecutado de preferencia como root para que su funcionamiento no se vea limitado o bien con un usuario que sea sudo.<\/span><\/div>\n<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; text-align: justify;\">Para que el script pueda funcionar sin ning\u00fan tipo de problemas, lo mejor es que sea iniciado con privilegios administrativos (root), as\u00ed como es obvio que se necesita que se inicie junto al ordenador, de esta forma nos aseguramos que si el ordenador es reiniciado o apagado, cuando vuelva a iniciar el script estar\u00e1 ah\u00ed funcionando, listo para extraer de cualquier USB lo que deseamos \ud83d\ude09<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 30px; text-align: justify;\"><span style=\"box-sizing: border-box; font-weight: bold;\">1.<\/span>\u00a0Supongamos que tenemos ambos archivos en\u00a0<span style=\"box-sizing: border-box; font-weight: bold;\"><em style=\"box-sizing: border-box;\">\/opt\/<\/em><\/span>\u00a0(<em style=\"box-sizing: border-box;\"><span style=\"box-sizing: border-box; font-weight: bold;\">\/opt\/usb-spy.sh<\/span><\/em>\u00a0y\u00a0<em style=\"box-sizing: border-box;\"><span style=\"box-sizing: border-box; font-weight: bold;\">\/opt\/usb-spy.files<\/span><\/em>), debemos darle privilegios de ejecuci\u00f3n:<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 60px;\"><span style=\"box-sizing: border-box; font-weight: bold;\"><code style=\"background: url('http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/terminal.png') 50% 0% no-repeat scroll #2d2d2d; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid #000000; box-sizing: border-box; color: #828fff; display: block; font-family: 'Roboto Mono', Consolas, monaco, monospace; font-size: 14px; font-weight: normal; margin: 8px 15px; padding: 30px 4px 10px; text-shadow: none; white-space: pre-wrap;\">sudo chmod +x \/opt\/usb-spy.sh<\/code><\/span><\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 30px;\"><span style=\"box-sizing: border-box; font-weight: bold;\">2.<\/span>\u00a0Abrimos el archivo\u00a0<em style=\"box-sizing: border-box;\"><span style=\"box-sizing: border-box; font-weight: bold;\">\/etc\/rc.local<\/span><\/em>\u00a0:<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 60px;\"><span style=\"box-sizing: border-box; font-weight: bold;\"><code style=\"background: url('http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/terminal.png') 50% 0% no-repeat scroll #2d2d2d; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid #000000; box-sizing: border-box; color: #828fff; display: block; font-family: 'Roboto Mono', Consolas, monaco, monospace; font-size: 14px; font-weight: normal; margin: 8px 15px; padding: 30px 4px 10px; text-shadow: none; white-space: pre-wrap;\">sudo nano \/etc\/rc.local<\/code><\/span><\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 30px;\"><span style=\"box-sizing: border-box; font-weight: bold;\">3.<\/span>\u00a0En \u00e9l escribimos arriba de la l\u00ednea final (<em style=\"box-sizing: border-box;\">exit 0<\/em>) lo siguiente:<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 60px;\"><span style=\"box-sizing: border-box; font-weight: bold;\">\/opt\/usb-spy.sh &amp;<\/span><\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 30px; text-align: justify;\"><span style=\"box-sizing: border-box; font-weight: bold;\">4.<\/span>\u00a0Ahora presionamos [Ctrl]+[X] para guardar y salir del archivo, presionamos [S] o [Y] (en dependencia del idioma del sistema) y luego [Enter]. Esto bastar\u00e1 para que se guarden los cambios que hicimos.<\/div>\n<div style=\"box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px;\">Y listo, esto bastar\u00e1 para que el script se inicie como root cuando encendamos el ordenador.<br \/>\nEs importante verificar que el archivo\u00a0<em style=\"box-sizing: border-box;\">usb-spy.files<\/em>\u00a0est\u00e9 en el mismo directorio de\u00a0<em style=\"box-sizing: border-box;\">usb-spy.sh<\/em><br \/>\n<em style=\"box-sizing: border-box;\"><br \/>\n<\/em><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hace poco quer\u00eda un escritp en bash que me indicara cuando la carga de la bateria de mi laptop estuviera llena, no tuve mucha suerte con la b\u00fasqueda, sin embargo encontr\u00e9 un escritp en bash que realiza las siguientes \u00a0funciones: Detectar cuando se conecta un dispositivo USB a la computadora Copiar todo el contenido de [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[383,1427,4,1426,429,1428,681],"tags":[],"class_list":["post-1813","post","type-post","status-publish","format-standard","hentry","category-bash","category-copiar","category-linux","category-pendrive","category-script","category-spiar","category-usb"],"_links":{"self":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/comments?post=1813"}],"version-history":[{"count":1,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1813\/revisions"}],"predecessor-version":[{"id":2477,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1813\/revisions\/2477"}],"wp:attachment":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/media?parent=1813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/categories?post=1813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/tags?post=1813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}