elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


  Mostrar Mensajes
Páginas: [1]
1  Programación / Scripting / Que función cumple este script? en: 12 Junio 2017, 04:15 am
Buenos dia gente! -Necesito saber para que sirve este script ya que yo no puedo comprender que hace.
El script pertenece al paquete de aptitude y el script es el aptitude-run-state-bundle.

Código
  1. #!/bin/bash
  2.  
  3. NO_CLEAN=0
  4. STATEDIR=0
  5. UNPACK_ONLY=0
  6. HELP=0
  7. APPEND=1
  8.  
  9. DONE=0
  10. while [ $DONE = 0 ]
  11. do
  12.  case "$1" in
  13.      --append-args )
  14.          APPEND=1
  15.          shift
  16.          ;;
  17.      --help )
  18.          HELP=1
  19.          shift
  20.          ;;
  21.      --no-clean )
  22.          NO_CLEAN=1
  23.          shift
  24.          ;;
  25.      --prepend-args )
  26.          APPEND=0
  27.          shift
  28.          ;;
  29.      --really-clean )
  30.          NO_CLEAN=0
  31.          shift
  32.              ;;
  33.      --statedir )
  34.          STATEDIR=1
  35.          NO_CLEAN=1
  36.          shift
  37.          ;;
  38.      --unpack )
  39.          UNPACK_ONLY=1
  40.          shift
  41.          ;;
  42.      * )
  43.          DONE=1
  44.          ;;
  45.  esac
  46. done
  47.  
  48. if ( [ $UNPACK_ONLY = 0 ] && [ "$#" -lt 1 ] ) ||
  49.   ( [ $UNPACK_ONLY = 1 ] && [ "$#" -ne 1 ] ) ||
  50.   [ $HELP = 1 ]
  51. then
  52.    echo "Usage: $0 [options] <input-file> [<program> [arguments ...]]"
  53.    echo
  54.    echo "This command will unpack the given archive of aptitude state"
  55.    echo "information, then invoke the given program with the given"
  56.    echo "list of arguments, passing appropriate -o options to cause"
  57.    echo "aptitude to use the contents of that archive as its global"
  58.    echo "data store."
  59.    echo
  60.    echo "Options:"
  61.    echo "  --append-args    Place the generated arguments at the end of"
  62.    echo "                   the command line (default)."
  63.     echo "  --help           Display this message and exit."
  64.    echo "  --no-clean       Do not remove the temporary directory after"
  65.    echo "                   invoking aptitude."
  66.    echo "  --prepend-args   Place the generated arguments at the beginning"
  67.    echo "                   of the command line."
  68.    echo "  --really-clean   Remove the state directory, even if --statedir"
  69.    echo "                   was passed as an argument."
  70.    echo "  --statedir       The <input-file> is an unpacked aptitude bundle,"
  71.    echo "                   not a bundle file; implicitly sets --no-clean."
  72.    echo "  --unpack         Just unpack the <input-file>, don't run aptitude."
  73.    exit 1
  74. fi
  75.  
  76. INPUTFILE="$1"
  77. shift
  78.  
  79. if [ "$#" -lt 1 ]
  80. then
  81.    PROGRAM=aptitude
  82. else
  83.    PROGRAM="$1"
  84.    shift
  85. fi
  86.  
  87. if [ $STATEDIR = 0 ]
  88. then
  89.    tempdir=$(mktemp -p ${TMPDIR:-/tmp} -d aptitudebug.XXXXXXXXX) || exit 1
  90.    if [ -z "$tempdir" ]
  91.        then
  92.        exit 1
  93.    fi
  94. else
  95.    tempdir=$INPUTFILE
  96. fi
  97.  
  98. trap '
  99. if [ $NO_CLEAN = 1 ]
  100. then echo "Leaving final state in $tempdir"
  101. else echo "Removing $tempdir"; rm -fr $tempdir
  102. fi' 0
  103.  
  104. if [ $STATEDIR = 0 ]
  105. then
  106.    if [ -d "$INPUTFILE" ]
  107.    then
  108.        echo "Can't use $INPUTFILE as the input bundle: it's a directory."
  109.        exit 1
  110.    fi
  111.    if ! [ -f "$INPUTFILE" ]
  112.    then
  113.        echo "Can't use $INPUTFILE as the input bundle: file not found."
  114.        exit 1
  115.    fi
  116.  
  117.    tar -C "$tempdir" -xf "$INPUTFILE" || exit 1
  118. fi
  119.  
  120. if [ $UNPACK_ONLY = 1 ]
  121. then
  122.    exit 0
  123. fi
  124. if [ "$APPEND" = 1 ]
  125. then
  126.    "$PROGRAM" "$@" -o "Dir=$tempdir" -o "Dir::State::status=$tempdir/var/lib/dpkg/status"
  127. else
  128.  
  129.    "$PROGRAM" -o "Dir=$tempdir" -o "Dir::State::status=$tempdir/var/lib/dpkg/status" "$@"
  130. fi
  131.  
  132.  
2  Programación / Scripting / Re: Alguna shell linux online??? en: 1 Junio 2017, 13:45 pm
Muchísimas gracias por su información "chakan" y "Alej". Saludos
3  Programación / Scripting / Alguna shell linux online??? en: 1 Junio 2017, 02:43 am
Buenas a todos... Si alguno tiene algún dato de paginas donde pueda usar consolas online basadas en Linux.. Es para poder practicar desde otros lugares que no sea mi casa..

PD: Que no sea Webminal porque no me gusto, anda demasiado lento...
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines