Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.15.192.89
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/task/2/root/proc/3/root/proc/3/root/usr/share/doc/fetchmail/contrib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/task/2/root/proc/3/root/proc/3/root/usr/share/doc/fetchmail/contrib/delete-later
#!/usr/bin/expect -f

# MySQL database connection settings
set CRDB_host     localhost
set CRDB_DB       test
set CRDB_username root
set CRDB_password root

# set eiter one to 1 for verbose output
log_user 0
set comments 0

package require mysqltcl

# connect to MySQL database
set handle [::mysql::connect -host $CRDB_host -user $CRDB_username -password $CRDB_password]

# get server/usernames to clean up
set userlist [::mysql::sel $handle "SELECT UserID, server, username, password, retaindays from $CRDB_DB.fetchmail_user" -flatlist]

# loop through all users in database
foreach {userid server username password days} $userlist {
  if {$comments==1} { send_user "\r\nWorking on accound #$userid\r\n*******************************\r\n" }
  eval spawn telnet -l fetchmail_cleanup $server 110
  expect "ready"
  send "USER $username\r"
  expect "password"
  send "PASS $password\r"
  expect "OK"
  send "STAT\r"
  expect "+OK "
  expect -re "\[0-9]* "
  set anz $expect_out(0,string)
  if {$comments==1} { send_user "message count: $anz \r\n" }
  set i 0
  while { $i < $anz } {
    incr i
    send "UIDL $i\r"
    expect -re "\\\+OK $i \(.*\)\r"
    set uid $expect_out(1,string)
    ::mysql::exec $handle "insert ignore into $CRDB_DB.fetchmail values ($userid,'$uid',now());"
    set age [::mysql::sel $handle "SELECT DATEDIFF(now(),Fetchdate) from $CRDB_DB.fetchmail where UserID=$userid and UID='$uid'" -list]
    if {$comments==1} { send_user "Message #$i: UID: $uid , age: $age \r\n" }
    if {$age > $days} {
      send "DELE $i\r"
      expect "deleted"
      if {$comments==1} { send_user "Message $i deleted.\r\n" }
    }
  }
  send "quit\r"
  expect "signing off"
  ::mysql::exec $handle "delete from $CRDB_DB.fetchmail where DATEDIFF(now(),Fetchdate)>($days*2) and UserID=$userid;"
}
::mysql::close $handle
exit


Anon7 - 2022
AnonSec Team