shinemic

myfirstshell.sh

Dec 2nd, 2023
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.05 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # a)
  4. # name:        lazydog
  5. # filename:    myfirstshell.sh
  6. # description: of no sense
  7.  
  8. export SCRIPTNAME="$(cd "$(dirname $0)"; echo "$PWD/$(basename $0)")"
  9.  
  10. bash -s <<-'EOF'
  11.     perl -mPOSIX=strftime -E "$(perl -CSDA -pe \
  12.         's/^\s*\K#([a-z]+ \(.*?\))\)/say \"\n========== $1 ==========\";/g' <<'EOS'
  13.         #b (greeting))
  14.         $users = `cut -d: -f1 /etc/passwd`;
  15.         chomp($cur_user = `grep -Po '^# name:\\s*\\K.*' $ENV{SCRIPTNAME}`);
  16.         say +($users =~ $cur_user) ? "Hello! $cur_user" : "Fuck you, $cur_user!";
  17.  
  18.         #c (date & time))
  19.         say strftime('%Y-%m-%d %T', localtime);
  20.  
  21.         #d (calendar))
  22.         system('cal');
  23.  
  24.         #e (machine name))
  25.         system('hostname');
  26.  
  27.         #f (operation system & version))
  28.         system(q{grep -Pwo '(NAME|VERSION)="\K[^"]+' /etc/os-release |
  29.                  sed '1s/^/operation: /; 2s/^/version: /'});
  30.  
  31.         #g (file in parent path))
  32.         system('ls ..');
  33.  
  34.         #h (processes ownered by root (keep 10 items))
  35.         system(q{ps -ef | awk '/^root/&&$8!~/^\[/' | head -10});
  36.  
  37.         #i (env value: TERM PATH HOME))
  38.         say "$_: @{[$ENV{$_} =~ s/:/\n      /gr]}" for qw[TERM PATH HOME];
  39.  
  40.         #j (disk usage))
  41.         system('df -h');
  42.  
  43.         #k (group id))
  44.         system('id -g');
  45.  
  46.         #m (bye))
  47.         system(q#
  48.         python -c 'print("".join(chr(int([x[8:] + x[:8] for x in [format(((
  49.         int(__import__("math").sqrt(((1 << 64) - 1) ^ int("".join(list(map(
  50.         lambda x: "".join(x),zip(*[iter(b)] * 8)))[::-1]), 2))) >> 8) & ((1
  51.         << 16) - 1)), "016b")]][0][::-1], 2))for b in map("".join,zip(*[
  52.         iter([s1[(len(s1) % 64) // 2:(len(s1) - (len(s1) % 64 -(len(s1) % 64)
  53.         // 2))]for s1 in ["".join("""
  54.         ○ ● ● ● ● ○ ● ● ● ● ○ ● ● ● ● ● ● ● ○ ● ● ● ●
  55.         ● ● ● ○ ● ● ● ○ ● ● ○ ● ○ ● ● ○ ○ ○ ○ ● ○ ○ ●
  56.         ○ ● ● ○ ○ ○ ● ● ● ● ● ○ ● ○ ● ○ ● ● ● ● ● ○ ●
  57.         ○ ● ○ ○ ● ● ● ● ○ ● ● ● ● ● ● ● ● ○ ○ ● ● ● ○
  58.         ○ ● ○ ● ● ● ● ○ ○ ● ● ● ○ ● ○ ○ ○ ○ ● ● ○ ● ●
  59.         ● ○ ○ ○ ○ ● ● ● ○ ○ ● ● ○ ● ● ● ● ● ○ ● ○ ● ●
  60.         ○ ● ● ● ○ ● ○ ○ ● ● ● ● ○ ● ● ○ ○ ○ ○ ○ ○ ● ○
  61.         ● ● ○ ● ● ● ○ ● ○ ○ ● ○ ● ● ○ ○ ○ ○ ● ● ○ ● ○
  62.         ○ ○ ○ ● ● ● ○ ● ○ ○ ● ● ● ○ ● ○ ○ ● ○ ○ ○ ● ○
  63.         ● ○ ○ ○ ● ● ● ● ● ● ○ ● ● ● ○ ● ● ● ● ● ● ● ●
  64.         ● ○ ○ ○ ● ● ● ○ ● ○ ○ ● ● ○ ○ ● ● ● ● ● ● ○ ○
  65.         ● ● ○ ● ● ● ○ ● ● ○ ● ● ● ○ ● ● ○ ● ● ● ○ ● ○
  66.         ● ○ ○ ○ ● ● ● ● ○ ○ ● ● ● ○ ● ○ ● ● ○ ● ● ○ ○
  67.         ● ● ○ ○ ○ ● ○ ● ● ○ ○ ● ● ○ ● ○ ○ ● ● ○ ● ○ ○
  68.         ● ○ ○ ● ● ○ ● ○ ● ○ ● ● ○ ● ○ ● ● ● ● ○ ● ● ●
  69.         ● ○ ○ ● ○ ● ○ ○ ○ ● ● ○ ○ ● ○ ● ● ● ● ○ ● ● ○
  70.         ○ ● ● ○ ● ● ○ ● ● ● ● ● ○ ● ● ○ ○ ● ○ ○ ● ○ ○
  71.         ○ ● ○ ● ○ ● ○ ○ ○ ○ ● ● ○ ● ● ● ● ● ● ● ● ● ○
  72.         ● ● ● ● ● ○ ● ○ ○ ● ● ○ ● ● ○ ● ○ ○ ● ○ ● ● ●
  73.         ○ ○ ○ ○ ● ● ● ● ○ ● ● ● ○ ○ ○ ○ ○ ● ○ ● ● ○ ●
  74.         ○ ● ● ○ ○ ● ● ○ ● ○ ● ○ ○ ● ● ○ ● ○ ○ ● ● ○ ○
  75.         ○ ○ ● ○ ○ ○ ● ○ ○ ○ ● ● ● ○ ● ● ● ○ ● ○ ○ ○ ○
  76.         ○ ● ● ● ○ ● ○ ● ● ● ● ● ● ● ● ● ● ● ○ ○ ○ ● ●
  77.         """.strip().split("\n")[::-1]).replace(" ", "").translate(
  78.         str.maketrans(dict(zip("○●", "01"))))]][0])] * 64))))'
  79.         #);
  80.  
  81.     EOS
  82. )"
  83. EOF
  84.  
Add Comment
Please, Sign In to add comment