__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
/*
 * Copyright (C) 1999-2018 D. Gilbert
 * 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, or (at your option)
 * any later version.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * Test code for D. Gilbert's extensions to the Linux OS SCSI generic ("sg")
 * device driver.
 * This program does a SCSI inquiry command on the given device and
 * outputs some of the result. This program highlights the use of the
 * SCSI_IOCTL_SEND_COMMAND ioctl. This should be able to be applied to
 * any SCSI device file descriptor (not just one related to sg). [Whether
 * this is a good idea on a disk while it is mounted is debatable.
 * No detrimental effects when this was tested ...]
 *
 * Version 0.16 20181207
 */

#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <scsi/scsi.h>
/* #include <scsi/scsi_ioctl.h> */ /* glibc hides this file sometimes */

typedef struct my_scsi_ioctl_command {
        unsigned int inlen;  /* _excluding_ scsi command length */
        unsigned int outlen;
        unsigned char data[1];  /* was 0 but that's not ISO C!! */
                /* on input, scsi command starts here then opt. data */
} My_Scsi_Ioctl_Command;

#define OFF (2 * sizeof(unsigned int))

#ifndef SCSI_IOCTL_SEND_COMMAND
#define SCSI_IOCTL_SEND_COMMAND 1
#endif

#define INQUIRY_CMD     0x12
#define INQUIRY_CMDLEN  6
#define INQUIRY_REPLY_LEN 96


int main(int argc, char * argv[])
{
    int s_fd, res, k, to;
    unsigned char inq_cdb [INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0,
                                                INQUIRY_REPLY_LEN, 0};
    unsigned char * inqBuff = (unsigned char *)
                                malloc(OFF + sizeof(inq_cdb) + 512);
    unsigned char * buffp = inqBuff + OFF;
    My_Scsi_Ioctl_Command * ishp = (My_Scsi_Ioctl_Command *)inqBuff;
    char * file_name = 0;
    int do_nonblock = 0;
    int oflags = 0;

    for (k = 1; k < argc; ++k) {
        if (0 == strcmp(argv[k], "-n"))
            do_nonblock = 1;
        else if (*argv[k] != '-')
            file_name = argv[k];
        else {
            printf("Unrecognized argument '%s'\n", argv[k]);
            file_name = 0;
            break;
        }
    }
    if (0 == file_name) {
        printf("Usage: 'scsi_inquiry [-n] <scsi_device>'\n");
        printf("     where: -n   open device in non-blocking mode\n");
        printf("  Examples: scsi_inquiry /dev/sda\n");
        printf("            scsi_inquiry /dev/sg0\n");
        printf("            scsi_inquiry -n /dev/scd0\n");
        return 1;
    }

    if (do_nonblock)
        oflags = O_NONBLOCK;
    s_fd = open(file_name, oflags | O_RDWR);
    if (s_fd < 0) {
        if ((EROFS == errno) || (EACCES == errno)) {
            s_fd = open(file_name, oflags | O_RDONLY);
            if (s_fd < 0) {
                perror("scsi_inquiry: open error");
                return 1;
            }
        }
        else {
            perror("scsi_inquiry: open error");
            return 1;
        }
    }
    /* Don't worry, being very careful not to write to a none-scsi file ... */
    res = ioctl(s_fd, SCSI_IOCTL_GET_BUS_NUMBER, &to);
    if (res < 0) {
        /* perror("ioctl on scsi device, error"); */
        printf("scsi_inquiry: not a scsi device\n");
        return 1;
    }

    ishp->inlen = 0;
    ishp->outlen = INQUIRY_REPLY_LEN;
    memcpy(buffp, inq_cdb, INQUIRY_CMDLEN);
    res = ioctl(s_fd, SCSI_IOCTL_SEND_COMMAND, inqBuff);
    if (0 == res) {
        to = (int)*(buffp + 7);
        printf("    %.8s  %.16s  %.4s, byte_7=0x%x\n", buffp + 8,
               buffp + 16, buffp + 32, to);
    }
    else if (res < 0)
        perror("scsi_inquiry: SCSI_IOCTL_SEND_COMMAND err");
    else
        printf("scsi_inquiry: SCSI_IOCTL_SEND_COMMAND status=0x%x\n", res);

    res = close(s_fd);
    if (res < 0) {
        perror("scsi_inquiry: close error");
        return 1;
    }
    return 0;
}

Filemanager

Name Type Size Permission Actions
archive Folder 0755
Makefile File 3.08 KB 0644
Makefile.freebsd File 1.98 KB 0644
README File 776 B 0644
forwarded_sense.txt File 296 B 0644
nvme_dev_self_test.hex File 806 B 0644
nvme_identify_ctl.hex File 1.17 KB 0644
nvme_read_ctl.hex File 1.79 KB 0644
nvme_write_ctl.hex File 1.8 KB 0644
reassign_addr.txt File 465 B 0644
ref_sense.txt File 305 B 0644
scsi_inquiry.c File 4.09 KB 0644
sdiag_sas_p0_cjtpat.txt File 405 B 0644
sdiag_sas_p0_prbs9.txt File 407 B 0644
sdiag_sas_p1_cjtpat.txt File 464 B 0644
sdiag_sas_p1_idle.txt File 560 B 0644
sdiag_sas_p1_prbs15.txt File 408 B 0644
sdiag_sas_p1_stop.txt File 359 B 0644
sg__sat_identify.c File 7.55 KB 0644
sg__sat_phy_event.c File 12.02 KB 0644
sg__sat_set_features.c File 9.7 KB 0644
sg_compare_and_write.txt File 2.42 KB 0644
sg_excl.c File 5.98 KB 0644
sg_persist_tst.sh File 3.54 KB 0755
sg_sat_chk_power.c File 8.95 KB 0644
sg_sat_smart_rd_data.c File 6.4 KB 0644
sg_simple1.c File 5.87 KB 0644
sg_simple16.c File 3.41 KB 0644
sg_simple2.c File 6.59 KB 0644
sg_simple3.c File 6.46 KB 0644
sg_simple4.c File 7.25 KB 0644
sg_simple5.c File 7.47 KB 0644
sg_unmap_example.txt File 1.53 KB 0644
sgq_dd.c File 37.77 KB 0644
transport_ids.txt File 1.1 KB 0644
Filemanager