Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 18.223.33.204
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/doc/xz-utils/extra/scanlzma/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/doc/xz-utils/extra/scanlzma/scanlzma.c
/*
    scanlzma, scan for lzma compressed data in stdin and echo it to stdout.
    Copyright (C) 2006 Timo Lindfors

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
*/

/* Usage example:

   $ wget http://www.wifi-shop.cz/Files/produkty/wa2204/wa2204av1.4.1.zip
   $ unzip wa2204av1.4.1.zip
   $ gcc scanlzma.c -o scanlzma -Wall
   $ ./scanlzma 0 < WA2204-FW1.4.1/linux-1.4.bin | lzma -c -d | strings | grep -i "copyright"
   UpdateDD version 2.5, Copyright (C) 2005 Philipp Benner.
   Copyright (C) 2005 Philipp Benner.
   Copyright (C) 2005 Philipp Benner.
   mawk 1.3%s%s %s, Copyright (C) Michael D. Brennan
   # Copyright (C) 1998, 1999, 2001  Henry Spencer.
   ...

*/


/* LZMA compressed file format */
/* --------------------------- */
/* Offset Size Description */
/*   0     1   Special LZMA properties for compressed data */
/*   1     4   Dictionary size (little endian) */
/*   5     8   Uncompressed size (little endian). -1 means unknown size */
/*  13         Compressed data */

#define BUFSIZE 4096

int find_lzma_header(unsigned char *buf) {
	return (buf[0] < 0xE1
		&& buf[0] == 0x5d
		&& buf[4] < 0x20
		&& (memcmp (buf + 10 , "\x00\x00\x00", 3) == 0
		    || (memcmp (buf + 5, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", 8) == 0)));
}

int main(int argc, char *argv[]) {
	char buf[BUFSIZE];
	int ret, i, numlzma, blocks=0;

	if (argc != 2) {
		printf("usage: %s numlzma < infile | lzma -c -d > outfile\n"
		       "where numlzma is index of lzma file to extract, starting from zero.\n",
		       argv[0]);
		exit(1);
	}
	numlzma = atoi(argv[1]);

	for (;;) {
		/* Read data. */
		ret = fread(buf, BUFSIZE, 1, stdin);
		if (ret != 1)
			break;

		/* Scan for signature. */
		for (i = 0; i<BUFSIZE-23; i++) {
			if (find_lzma_header(buf+i) && numlzma-- <= 0) {
				fwrite(buf+i, (BUFSIZE-i), 1, stdout);
				for (;;) {
					int ch;
					ch = getchar();
					if (ch == EOF)
						exit(0);
					putchar(ch);
				}
			}
		}
		blocks++;
	}
	return 1;
}

Anon7 - 2022
AnonSec Team