Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../../../../../../../sbin
الملفات الموجودة في هذا الـ Path:
.
..
a2disconf
a2dismod
a2dissite
a2enconf
a2enmod
a2ensite
a2query
aa-remove-unknown
aa-status
aa-teardown
accessdb
acpid
add-shell
addgnupghome
addgroup
adduser
agetty
apache2
apache2ctl
apachectl
apparmor_parser
apparmor_status
applygnupgdefaults
arp
arpd
arptables
arptables-nft
arptables-nft-restore
arptables-nft-save
arptables-restore
arptables-save
aspell-autobuildhash
auth-otp
badblocks
bcache-super-show
biosdecode
blkdeactivate
blkdiscard
blkid
blkzone
blockdev
bridge
cache_check
cache_dump
cache_metadata_size
cache_repair
cache_restore
cache_writeback
capsh
cfdisk
cgdisk
chcpu
check_forensic
chgpasswd
chmem
chpasswd
chroot
clamd
clamonacc
convertquota
cpgr
cppw
cron
cryptdisks_start
cryptdisks_stop
cryptsetup
cryptsetup-reencrypt
cryptsetup-ssh
ctrlaltdel
dcb
ddns-confgen
debugfs
delgroup
deluser
depmod
devlink
dhclient
dhclient-script
dmeventd
dmidecode
dmsetup
dmstats
dosfsck
dosfslabel
dovecot
dpkg-preconfigure
dpkg-reconfigure
dumpe2fs
e2freefrag
e2fsck
e2image
e2label
e2mmpstatus
e2scrub
e2scrub_all
e2undo
e4crypt
e4defrag
ebtables
ebtables-nft
ebtables-nft-restore
ebtables-nft-save
ebtables-restore
ebtables-save
edquota
era_check
era_dump
era_invalidate
era_restore
ethtool
faillock
fatlabel
fcgiwrap
fdisk
filefrag
findfs
firewalld
fixparts
fsadm
fsck
fsck.btrfs
fsck.cramfs
fsck.ext2
fsck.ext3
fsck.ext4
fsck.fat
fsck.minix
fsck.msdos
fsck.vfat
fsck.xfs
fsfreeze
fstab-decode
fstrim
ftpasswd
ftpmail
ftpquota
ftpscrub
ftpshut
ftpstats
gdisk
genl
getcap
getpcaps
getty
groupadd
groupdel
groupmems
groupmod
grpck
grpconv
grpunconv
grub-bios-setup
grub-install
grub-macbless
grub-mkconfig
grub-mkdevicemap
grub-probe
grub-reboot
grub-set-default
halt
hdparm
httxt2dbm
hwclock
iconvconfig
ifconfig
ifdown
ifquery
ifup
in.proftpd
init
insmod
install-sgmlcatalog
installkernel
integritysetup
invoke-rc.d
ip
ip6tables
ip6tables-apply
ip6tables-legacy
ip6tables-legacy-restore
ip6tables-legacy-save
ip6tables-nft
ip6tables-nft-restore
ip6tables-nft-save
ip6tables-restore
ip6tables-restore-translate
ip6tables-save
ip6tables-translate
ipmaddr
ipset
ipset-translate
iptables
iptables-apply
iptables-legacy
iptables-legacy-restore
iptables-legacy-save
iptables-nft
iptables-nft-restore
iptables-nft-save
iptables-restore
iptables-restore-translate
iptables-save
iptables-translate
iptunnel
irqbalance
irqbalance-ui
isadump
isaset
iscsi-iname
iscsi_discovery
iscsiadm
iscsid
iscsistart
isosize
ispell-autobuildhash
iucode-tool
iucode_tool
jk_check
jk_chrootlaunch
jk_chrootsh
jk_cp
jk_init
jk_jailuser
jk_list
jk_lsh
jk_socketd
jk_update
kbdrate
killall5
kpartx
ldattach
ldconfig
ldconfig.real
locale-gen
logrotate
logsave
losetup
lsmod
luksformat
lvchange
lvconvert
lvcreate
lvdisplay
lvextend
lvm
lvmconfig
lvmdiskscan
lvmdump
lvmpolld
lvmsadc
lvmsar
lvreduce
lvremove
lvrename
lvresize
lvs
lvscan
make-bcache
make-ssl-cert
mariadbd
mdadm
mdmon
mii-tool
milter-greylist
mkdosfs
mke2fs
mkfs
mkfs.bfs
mkfs.btrfs
mkfs.cramfs
mkfs.ext2
mkfs.ext3
mkfs.ext4
mkfs.fat
mkfs.minix
mkfs.msdos
mkfs.ntfs
mkfs.vfat
mkfs.xfs
mkhomedir_helper
mkinitramfs
mklost+found
mkntfs
mkswap
modinfo
modprobe
mount.fuse
mount.fuse3
mount.lowntfs-3g
mount.ntfs
mount.ntfs-3g
mpathpersist
multipath
multipathd
mysqld
named
nameif
needrestart
newusers
nfnl_osf
nft
nologin
ntfsclone
ntfscp
ntfslabel
ntfsresize
ntfsundelete
on_ac_power
opendkim
opendkim-atpszone
opendkim-expire
opendkim-gengraphs
opendkim-genkey
opendkim-genstats
opendkim-genzone
opendkim-importstats
opendkim-stats
opendkim-testkey
opendkim-testmsg
overlayroot-chroot
ownership
pam-auth-update
pam_extrausers_chkpwd
pam_extrausers_update
pam_getenv
pam_timestamp_check
paperconfig
parted
partprobe
pdata_tools
php-fpm7.4
php-fpm8.0
php-fpm8.1
php-fpm8.2
php-fpm8.3
phpdismod
phpenmod
phpquery
pivot_root
plipconfig
plymouthd
policy-test
postalias
postcat
postconf
postdrop
postfix
postfix-add-filter
postfix-add-policy
postfix-collate
postgrey
postkick
postlock
postlog
postmap
postmulti
postqueue
postsuper
posttls-finger
poweroff
proftpd
proftpd-gencert
pvchange
pvck
pvcreate
pvdisplay
pvmove
pvremove
pvresize
pvs
pvscan
pwck
pwconv
pwunconv
qemu-ga
qmqp-sink
qmqp-source
qshape
quota_nld
quotacheck
quotaoff
quotaon
quotastats
rarp
readprofile
reboot
remove-default-ispell
remove-default-wordlist
remove-shell
repquota
resize2fs
rmail
rmmod
rmt
rmt-tar
rndc
rndc-confgen
route
rpc.rquotad
rsyslogd
rtacct
rtcwake
rtmon
runlevel
runuser
sasl-sample-server
saslauthd
sasldbconverter2
sasldblistusers2
saslpasswd2
saslpluginviewer
select-default-ispell
select-default-wordlist
sendmail
sensors-detect
service
setcap
setquota
setvesablank
setvtrgb
sfdisk
sgdisk
shadowconfig
shutdown
slattach
smtp-sink
smtp-source
spamd
split-logfile
sshd
start-stop-daemon
sudo_logsrvd
sudo_sendlog
sulogin
swaplabel
swapoff
swapon
switch_root
sysctl
tarcat
tc
telinit
testsaslauthd
thermald
thin_check
thin_delta
thin_dump
thin_ls
thin_metadata_size
thin_repair
thin_restore
thin_rmap
thin_trim
tipc
tsig-keygen
tune2fs
tzconfig
u-d-c-print-pci-ids
umount.udisks2
unix_chkpwd
unix_update
update-ca-certificates
update-catalog
update-default-aspell
update-default-ispell
update-default-wordlist
update-dictcommon-aspell
update-dictcommon-hunspell
update-grub
update-grub-gfxpayload
update-grub2
update-gsfontmap
update-icon-caches
update-info-dir
update-initramfs
update-locale
update-mime
update-passwd
update-pciids
update-rc.d
update-shells
update-xmlcatalog
upgrade-from-grub-legacy
usbmuxd
useradd
userdel
usermod
uuidd
validlocale
vcstime
vdpa
veritysetup
vgcfgbackup
vgcfgrestore
vgchange
vgck
vgconvert
vgcreate
vgdisplay
vgexport
vgextend
vgimport
vgimportclone
vgmerge
vgmknodes
vgreduce
vgremove
vgrename
vgs
vgscan
vgsplit
vigr
vipw
virtualmin
visudo
vpddecode
warnquota
wipefs
xfs_admin
xfs_bmap
xfs_copy
xfs_db
xfs_estimate
xfs_freeze
xfs_fsr
xfs_growfs
xfs_info
xfs_io
xfs_logprint
xfs_mdrestore
xfs_metadump
xfs_mkfile
xfs_ncheck
xfs_quota
xfs_repair
xfs_rtcp
xfs_scrub
xfs_scrub_all
xfs_spaceman
xqmstats
xtables-legacy-multi
xtables-monitor
xtables-nft-multi
zerofree
zic
zramctl
مشاهدة ملف: ftpmail
#!/usr/bin/perl
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2017 TJ Saunders <tj@castaglia.org>
#
# 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 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
# ---------------------------------------------------------------------------
use strict;
use File::Basename qw(basename);
use Getopt::Long;
use Mail::Sendmail;
use MIME::Base64 qw(encode_base64);
use Time::HiRes qw(usleep);
my $program = basename($0);
my $opts = {};
GetOptions($opts, 'attach-file', 'fifo=s', 'from=s', 'help', 'ignore-users=s',
'log=s', 'recipient=s@', 'upload-recipient=s@', 'download-recipient=s@',
'sleep=s', 'smtp-server=s', 'subject=s', 'watch-users=s', 'auth=s');
if ($opts->{help}) {
usage();
exit 0;
}
unless ($opts->{fifo}) {
print STDERR "$program: missing required --fifo parameter\n";
exit 1;
}
my $fifo = $opts->{fifo};
unless ($opts->{from}) {
print STDERR "$program: missing required --from parameter\n";
exit 1;
}
my $from = $opts->{from};
unless ($opts->{recipient} ||
$opts->{'upload-recipient'}) {
print STDERR "$program: missing required --recipient (or --upload-recipient) parameter\n";
exit 1;
}
my $upload_recipients = $opts->{recipient};
# The --upload-recipient list takes precedence over the (deprecated)
# --recipient list.
if (defined($opts->{'upload-recipient'})) {
$upload_recipients = $opts->{'upload-recipient'};
}
my $download_recipients = undef;
if (defined($opts->{'download-recipient'})) {
$download_recipients = $opts->{'download-recipient'};
}
unless ($opts->{'smtp-server'}) {
print STDERR "$program: missing required --smtp-server parameter\n";
exit 1;
}
my $smtp_server = $opts->{'smtp-server'};
my $smtp_auth;
if ($opts->{'auth'}) {
eval { $smtp_auth = get_auth_info($opts->{'auth'}) };
if ($@) {
my $ex = $@;
print STDERR "$program: unable to obtain SMTP auth info: $ex\n";
exit 1;
}
}
my $delay = 0.5;
if ($opts->{sleep}) {
$delay = $opts->{sleep};
}
my $fifoh;
if (open($fifoh, "< $fifo")) {
while (1) {
my $line = <$fifoh>;
if ($line) {
chomp($line);
if ($line =~ /^(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+(\d+)\s+(.*?)\s+(\d+)\s+(.*?)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*?)\s+.*?(\S+)$/o) {
my $curr_time = $1;
my $xfer_nsecs = $2;
my $client = $3;
my $nbytes = $4;
# Note that any spaces or control characters will be replaced in this
# path with underscores. This can make finding the actual file, as for
# attachments, rather difficult; we have to test to find the difference
# between a real underscore in the name, and a substituted underscore.
my $path = $5;
unless (-e $path) {
# Perform a quick-and-dirty check, on the assumption that all of the
# underscores in the given path are actually spaces. If a
# combination of underscores and spaces appears in the real file,
# we won't detect that here.
my $alt_path = $path;
$alt_path =~ s/_/ /g;
if (-e $alt_path) {
$path = $alt_path;
}
}
my $xfer_type = $6;
my $action_flag = $7;
my $xfer_direction = $8;
my $access_mode = $9;
my $user_name = $10;
my $completion_status = $11;
my $send_email = 0;
if ($xfer_direction eq 'i') {
$send_email = 1;
}
if (defined($download_recipients)) {
# If we have a list of download email recipients, it means we should
# send emails for downloads, too.
if ($xfer_direction eq 'o') {
$send_email = 1;
}
}
if ($send_email) {
# First, check for any specific --watch-users filter. If configured,
# and if the user name does NOT match the --watch-users filter, then
# don't send email. Otherwise, check for an --ignore-users filter,
# and see if the user matches that ignore filter.
if ($opts->{'watch-users'}) {
if ($user_name !~ /$opts->{'watch-users'}/) {
$send_email = 0;
}
} elsif ($opts->{'ignore-users'}) {
if ($user_name =~ /$opts->{'ignore-users'}/) {
$send_email = 0;
}
}
}
if ($send_email) {
send_email({
timestamp => $curr_time,
duration => $xfer_nsecs,
client => $client,
size => $nbytes,
file => $path,
transfer_type => $xfer_type,
auth_mode => $access_mode,
user => $user_name,
status => $completion_status,
direction => $xfer_direction,
});
}
}
if ($opts->{log}) {
# Note: since this opens, writes, then closes the log file for every
# write, it will interact with log rotation scripts MUCH better than
# proftpd by itself. Just one of the small benefits.
my $log_file = $opts->{log};
my $logfh;
if (open($logfh, ">> $log_file")) {
print $logfh "$line\n";
unless (close($logfh)) {
print STDERR "$program: error writing to log file '$log_file': $!\n";
}
} else {
print STDERR "$program: error opening log file '$log_file': $!\n";
}
}
} else {
# No input at this time. Sleep for half a second (or less) and check
# again.
usleep($delay * 1000000);
}
}
close($fifoh);
} else {
die "$program: unable to read FIFO '$fifo': $!\n";
}
sub get_auth_info {
my $path = shift;
my $info = {};
if (open(my $fh, "< $path")) {
while (my $line = <$fh>) {
chomp($line);
# Skip comments and blank lines
if ($line =~ /^(\s+)?#/) {
next;
}
if ($line =~ /^\s+$/) {
next;
}
if ($line =~ /^(\s+)?(\S+)(\s+)?=(\s+)?(.*)$/) {
my $key = $2;
my $val = $5;
# Trim off comments after the value, if any
$val =~ s/(\s*#.*)?$//;
# Ignore any keys other than 'user' and 'password'.
if (lc($key) eq 'user') {
$info->{'user'} = $val;
} elsif (lc($key) eq 'password' ||
lc($key) eq 'pass') {
$info->{'password'} = $val;
}
}
}
close($fh);
} else {
die("Can't read '$path': $!\n");
}
# Make sure that we have the required values
my $reqs = [qw(user password)];
foreach my $req (@$reqs) {
unless (exists($info->{$req})) {
die("Missing required '$req' value\n");
}
}
return $info;
}
sub send_email {
my $transfer_info = shift;
my $file = $transfer_info->{file};
my $file_str = basename($file);
my $transferred = 'uploaded';
if ($transfer_info->{direction} eq 'o') {
$transferred = 'downloaded';
}
my $subject = "User '$transfer_info->{user}' $transferred file '$file_str' via FTP";
if ($opts->{subject}) {
$subject = $opts->{subject};
}
my $bytes_str = "bytes";
if ($transfer_info->{size} == 1) {
$bytes_str = "byte";
}
my $status = "Completed";
if ($transfer_info->{status} eq 'i') {
$status = "Incomplete";
}
my $secs_str = "secs";
if ($transfer_info->{duration} == 1) {
$secs_str = "sec";
}
my $type_str = "Binary";
if ($transfer_info->{transfer_type} eq 'a') {
$type_str = "ASCII";
}
my $attached = "";
if ($opts->{'attach-file'} &&
-e $file) {
$attached = "(attached)";
}
my $text = <<EOT;
File just $transferred via FTP:
User: $transfer_info->{user}
Client: $transfer_info->{client}
File: $file $attached
Size: $transfer_info->{size} $bytes_str
At: $transfer_info->{timestamp}
Duration: $transfer_info->{duration} $secs_str
Status: $status
Transfer type: $type_str
Cheers,
--$program
EOT
my $email_info = {
smtp => $smtp_server,
From => $from,
Subject => $subject,
};
if ($transfer_info->{direction} eq 'i') {
$email_info->{To} = join(', ', @$upload_recipients);
} elsif ($transfer_info->{direction} eq 'o') {
$email_info->{To} = join(', ', @$download_recipients);
}
if ($opts->{'auth'}) {
$email_info->{'auth'} = $smtp_auth;
}
if ($opts->{'attach-file'}) {
if (-e $file) {
$email_info->{'MIME-Version'} = '1.0';
my $boundary = '====' . time() . '====';
$email_info->{'Content-Type'} = "multipart/mixed; boundary=\"$boundary\"";
$boundary = '--' . $boundary;
$email_info->{Body} .= "$boundary\n";
$email_info->{Body} .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$email_info->{Body} .= "Content-Transfer-Encoding: quoted-printable\n\n";
$email_info->{Body} .= "$text\n";
if (open(my $fh, "< $file")) {
binmode($fh);
# Note: this reads the entire file into memory, and can fail if
# the file is too big.
local $/;
my $attach;
while (my $data = <$fh>) {
$attach .= $data;
}
close($fh);
$email_info->{Body} .= "$boundary\n";
$email_info->{Body} .= "Content-Disposition: attachment; filename=\"$file\"\n";
if ($transfer_info->{transfer_type} eq 'a') {
$email_info->{Body} .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n\n";
$email_info->{Body} .= $attach;
} else {
$email_info->{Body} .= "Content-Type: application/octet-stream\n";
$email_info->{Body} .= "Content-Transfer-Encoding: base64\n\n";
$email_info->{Body} .= encode_base64($attach);
}
$email_info->{Body} .= "\n";
} else {
my $timestamp = scalar(localtime());
print STDERR "$program: $timestamp: error reading file '$file' for attaching: $!\n";
}
} else {
# Couldn't find/access the uploaded file on the filesystem. This usually
# indicates either a permissions problem, or a munged filename.
#
# XXX Need to handle this better.
}
} else {
$email_info->{Body} = $text;
}
my $res = Mail::Sendmail::sendmail(%$email_info);
unless ($res) {
my $timestamp = scalar(localtime());
print STDERR "$program: $timestamp: error sending email: $Mail::Sendmail::error\n";
}
}
sub usage {
print <<EOH;
usage: $program [--help] [--fifo \$path] [--from \$addr] [--log \$path]
[--recipient \$addrs] [--upload-recipient \$addrs]
[--download-recipient \$addrs] [--subject \$string] [--smtp-server \$addr]
[--attach-file] [--ignore-users \$regex | --watch-users \$regex]
The purpose of this script is to monitor the TransferLog written by proftpd
for uploaded files. Whenever a file is uploaded by a user, an email will be
sent to the specified recipients. In the email there will be the timestamp,
the name of the user who uploaded the file, the path to the uploaded file, the
size of the uploaded file, and the time it took to upload.
Command-line options:
--attach-file If used, this will cause a copy of the uploaded file
to be included, as an attachment, in the generated
email.
--auth \$path Configures the path to a file containing SMTP
authentication information.
The configured file should look like this:
user = \$user
password = \$password
--fifo \$path Indicates the path to the FIFO to which proftpd is
writing its TransferLog. That is, this is the path
that you used for the TransferLog directive in your
proftpd.conf. This parameter is REQUIRED.
--from \$addr Specifies the email address to use in the From header.
This parameter is REQUIRED.
--help Displays this message.
--ignore-users \$regex
Specifies a Perl regular expression. If the uploading
user name matches this regular expression, then NO
email notification is sent; otherwise, an email is
sent.
--log \$path Since this script reads the TransferLog using FIFOs,
the actual TransferLog file is not written by default.
Use this option to write the normal TransferLog file,
in addition to watching for uploads.
--recipient \$addr Specifies an email address to which to send an email
notification of the upload. This option can be
used multiple times to specify multiple recipients.
AT LEAST ONE recipient is REQUIRED.
--upload-recipient Same as --recipient.
--download-recipient \$addr
Specifies an email address to which to send an email
notification of the B<download>. This option can be
used multiple times to specify multiple recipients.
If this option is specified, then C<ftpmail> will
watch for FTP downloads as well as uploads.
--smtp-server \$addr Specifies the SMTP server to which to send the email.
This parameter is REQUIRED.
--subject \$string Specify a custom Subject header for the email sent.
The default Subject is:
User '\$user' uploaded file '\$file' via FTP
--watch-users \$regex Specifies a Perl regular expression. If the uploading
user name matches this regular expression, then an
email notification is sent; otherwise, no email is
sent.
EOH
}