!C99Shell v. 1.0 pre-release build #13!

Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a 

uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 

uid=99(nobody) gid=98(nobody) groups=98(nobody) 

Safe-mode: OFF (not secure)

/usr/src/linux-2.4.18-xfs-1.1/fs/proc/   drwxr-xr-x
Free 318.37 GB of 458.09 GB (69.5%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     proc_tty.c (4.38 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
 * proc_tty.c -- handles /proc/tty
 *
 * Copyright 1997, Theodore Ts'o
 */

#include <asm/uaccess.h>

#include <linux/init.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/tty.h>
#include <asm/bitops.h>

extern struct tty_driver *tty_drivers;    /* linked list of tty drivers */
extern struct tty_ldisc ldiscs[];


static int tty_drivers_read_proc(char *page, char **start, off_t off,
                 int count, int *eof, void *data);
static int tty_ldiscs_read_proc(char *page, char **start, off_t off,
                int count, int *eof, void *data);

/*
 * The /proc/tty directory inodes...
 */
static struct proc_dir_entry *proc_tty_ldisc, *proc_tty_driver;

/*
 * This is the handler for /proc/tty/drivers
 */
static int tty_drivers_read_proc(char *page, char **start, off_t off,
                 int count, int *eof, void *data)
{
    int    len = 0;
    off_t    begin = 0;
    struct tty_driver *p;
    char    range[20], deftype[20];
    char    *type;

    for (p = tty_drivers; p; p = p->next) {
        if (p->num > 1)
            sprintf(range, "%d-%d", p->minor_start,
                p->minor_start + p->num - 1);
        else
            sprintf(range, "%d", p->minor_start);
        switch (p->type) {
        case TTY_DRIVER_TYPE_SYSTEM:
            if (p->subtype == SYSTEM_TYPE_TTY)
                type = "system:/dev/tty";
            else if (p->subtype == SYSTEM_TYPE_SYSCONS)
                type = "system:console";
            else if (p->subtype == SYSTEM_TYPE_CONSOLE)
                type = "system:vtmaster";
            else
                type = "system";
            break;
        case TTY_DRIVER_TYPE_CONSOLE:
            type = "console";
            break;
        case TTY_DRIVER_TYPE_SERIAL:
            if (p->subtype == 2)
                type = "serial:callout";
            else
                type = "serial";
            break;
        case TTY_DRIVER_TYPE_PTY:
            if (p->subtype == PTY_TYPE_MASTER)
                type = "pty:master";
            else if (p->subtype == PTY_TYPE_SLAVE)
                type = "pty:slave";
            else
                type = "pty";
            break;
        default:
            sprintf(deftype, "type:%d.%d", p->type, p->subtype);
            type = deftype;
            break;
        }
        len += sprintf(page+len, "%-20s /dev/%-8s %3d %7s %s\n",
                   p->driver_name ? p->driver_name : "unknown",
                   p->name, p->major, range, type);
        if (len+begin > off+count)
            break;
        if (len+begin < off) {
            begin += len;
            len = 0;
        }
    }
    if (!p)
        *eof = 1;
    if (off >= len+begin)
        return 0;
    *start = page + (off-begin);
    return ((count < begin+len-off) ? count : begin+len-off);
}

/*
 * This is the handler for /proc/tty/ldiscs
 */
static int tty_ldiscs_read_proc(char *page, char **start, off_t off,
                int count, int *eof, void *data)
{
    int    i;
    int    len = 0;
    off_t    begin = 0;

    for (i=0; i < NR_LDISCS; i++) {
        if (!(ldiscs[i].flags & LDISC_FLAG_DEFINED))
            continue;
        len += sprintf(page+len, "%-10s %2d\n",
                   ldiscs[i].name ? ldiscs[i].name : "???", i);
        if (len+begin > off+count)
            break;
        if (len+begin < off) {
            begin += len;
            len = 0;
        }
    }
    if (i >= NR_LDISCS)
        *eof = 1;
    if (off >= len+begin)
        return 0;
    *start = page + (off-begin);
    return ((count < begin+len-off) ? count : begin+len-off);
}

/*
 * This function is called by tty_register_driver() to handle
 * registering the driver's /proc handler into /proc/tty/driver/<foo>
 */
void proc_tty_register_driver(struct tty_driver *driver)
{
    struct proc_dir_entry *ent;
        
    if ((!driver->read_proc && !driver->write_proc) ||
        !driver->driver_name ||
        driver->proc_entry)
        return;

    ent = create_proc_entry(driver->driver_name, 0, proc_tty_driver);
    if (!ent)
        return;
    ent->read_proc = driver->read_proc;
    ent->write_proc = driver->write_proc;
    ent->data = driver;

    driver->proc_entry = ent;
}

/*
 * This function is called by tty_unregister_driver()
 */
void proc_tty_unregister_driver(struct tty_driver *driver)
{
    struct proc_dir_entry *ent;

    ent = driver->proc_entry;
    if (!ent)
        return;
        
    remove_proc_entry(driver->driver_name, proc_tty_driver);
    
    driver->proc_entry = 0;
}

/*
 * Called by proc_root_init() to initialize the /proc/tty subtree
 */
void __init proc_tty_init(void)
{
    if (!proc_mkdir("tty", 0))
        return;
    proc_tty_ldisc = proc_mkdir("tty/ldisc", 0);
    /*
     * /proc/tty/driver/serial reveals the exact character counts for
     * serial links which is just too easy to abuse for inferring
     * password lengths and inter-keystroke timings during password
     * entry.
     */
    proc_tty_driver = proc_mkdir_mode("tty/driver", S_IRUSR | S_IXUSR, 0);

    create_proc_read_entry("tty/ldiscs", 0, 0, tty_ldiscs_read_proc,NULL);
    create_proc_read_entry("tty/drivers", 0, 0, tty_drivers_read_proc,NULL);
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0248 ]--