【亚洲必赢app官方下载】修改oracle口令安全题材

[20171225]变态的windows批处理4.txt

[20171225]变态的windows批处理4.txt

[oracle@hb shell_test]$ cat echo_time 
#!/bin/sh

[20171101]修改oracle口令安全问题.txt

–//前天求学windows 批处理的echo
&.使用它可以完结类似回车换行的功用.例子:

–//前些天攻读windows 批处理的echo
&.使用它可以兑现类似回车换行的作用.例子:

一.最简便的调用sqlplus
sqlplus -S “sys/unimas as sysdba” << !
select to_char(sysdate,’yyyy-mm-dd’) today from dual;
exit;
!

–//等保的题目,做一些有关修改oracle口令方面的测试.

1.echo &.
R:\>echo 1111 & echo 2222
1111
2222

1.echo &.
R:\>echo 1111 & echo 2222
1111
2222

[oracle@hb shell_test]$ ./echo_time 

1.oracle修改口令一般如下形式:

–//但是假若写成如下:

–//不过只要写成如下:

TODAY

2011-03-21

-S 是silent
mode,不出口接近“SQL>”,连接数据库,关闭数据库之类的音讯。

eof可以是其他字符串
比如”laldf”那么当您输入单独一行laldf时”shell认为输入完成,可是必须代表块起始必须利用<<;
发端和终止要协作这一个符号“<<”后边的内容
举例子:

[oracle@hb shell_test]$ sqlplus -s “sys/unimas as sysdba” <<
abc
> select to_char(sysdate,’yyyy-mm-dd’) today from dual;
> exit;
> abc

alter user scott identified by oracle;
password scott
其三方工具,平常也是实践以上类似的命令.我使用SQL
Tracker(toad自带的工具)测试,实际上执行的也是第1种方式.

R:\>echo 1111 & echo 2222 > aa.txt
1111

R:\>echo 1111 & echo 2222 > aa.txt
1111

TODAY

2011-03-21

二.sqlplus的结果传递给shell的法门一

[oracle@hb shell_test]$ cat test2.sh 
#!/bin/bash
VALUE=`sqlplus -S “test/unimas” << !
set heading off
set feedback off
set pagesize 0
set verify off
set echo off
select to_char(sysdate,’yyyy-mm-dd’) today from dual;
exit
!`
echo $VALUE
if [ -n “$VALUE” ]; then
echo “The rows is $VALUE”
exit 0
else
echo “There is no row”
fi

三.sqlplus的结果传递给shell的不二法门二

[oracle@hb shell_test]$ cat test1.sh 
#!/bin/bash
sqlplus -S “test/unimas” << !
set heading off
set feedback off
set pagesize 0
set verify off
set echo off
col coun new_value v_coun
select count(*) coun from lesson;
exit v_coun
!
VALUE=”$?”
echo “show row:$VALUE”

col coun new_value v_coun v_coun为number类型。因为exit
只可以回去数值类型。

四.把shell参数传递给sqlplus

#!/bin/bash
t_id=”$1″
sqlplus -S “test/unimas” << !
set heading off
set feedback off
set pagesize 0
set verify off
set echo off
select teachername from teacher where id=$t_id;
exit
!

五.sqlplus的结果存储在文书中

#!/bin/sh
sqlplus -S “test/unimas”<<EOF
set heading off
set feedback off
set pagesize 0
set verify off
set echo off
spool spool_file
SELECT * from teacher;
spool off
exit;
【亚洲必赢app官方下载】修改oracle口令安全题材。EOF

http://blog.chinaunix.net/space.php?uid=9124312&do=blog&id=181372

 

####################################################################################################################################

查阅调度系统状态脚本:

#!/bin/sh

if [[ -z “$1” ]] || [[ “$1” -ne 0 && “$1” -ne 2 ]]       #使用[[ ]] 举行逻辑不通操作
then
    echo “Please input your parameter: query status[0,2]!”
    exit
fi

#for buname in cnlog enlog ItLog JrLog AuLog InnerLog
for buname in cnlog enlog
do
    sqlplus -S ‘etl/etl@dw_testdb’ << abc        #利用 << EOF格局输入消息     set line 155
    set pages 9999
    SELECT /*+ PARALLEL(a,4) */ * FROM $buname.hla_job_rec a where
status = $1;
    exit
abc
done

2.测试:
–//我自己早已树立一个本子(我修改参加包括alter的情节):
# cat -v Tcpdumpsql
#! /bin/bash
/usr/sbin/tcpdump  -l -i eth0 -s 16384 -A -nn src host $1 and dst port
1521 2>/dev/null |  tee -a /tmp/aa1 |sed -u -e 
“s/^M/!/g;s/^E\.\..\{1,100\}//;s/\.*$//;s/^\.*//” | \
awk ‘{if (tolower($0) ~ “select” || tolower($0) ~ “update” || 
tolower($0) ~ “delete” ||tolower($0) ~ “alter” || tolower($0) ~ “insert”
|| $0 ~ “ORA-” ) {p=1;print} \
else if(p == 1 && $0 !~ “^[0-9][0-9]:”) {print} else if ($0 ~
“^[0-9][0-9]:”) {p=0}}’

R:\>cat aa.txt
2222

R:\>cat aa.txt
2222

–//注:^M 实际上在vi里面要透过ctrl+v ctrl+m输入(windows下ctrl+q
ctrl+m),首借使因为我们付出写PB代码使用~r而并未加~n,这样
–//在展现时因为没有换行呈现内容会被覆盖.

–//你能够发现1111,显示输出,而2222写入文件aa.txt,改写成管道看看.

–//你可以窥见1111,突显输出,而2222写入文件aa.txt,改写成管道看看.

3.测试alter user修改口令:
–//在client端登录,执行如下测试命令:
select sysdate from dual;
alter user scott identified by oracle;
select Sysdate from dual;

R:\>echo 1111 &echo 2222 | cat
1111
2222

R:\>echo 1111 &echo 2222 | cat
1111
2222

–//在服务器执行:
# Tcpdumpsql cliend_ip
–//注:client_id换成对应的ip.
select sysdate from dual
%alter user scott identified by oracle
select Sysdate from dual

–//OK.实际上那个是假象,第1行动显示器,第2行进管道,看上面的测试就知晓了.若是要写到文件实际上要加括号,这么些跟linux有一个相似.
R:\>(echo 1111 &echo 2222 ) > aa.txt

–//OK.实际上那一个是假象,第1行走屏幕,第2行走管道,看上边的测试就精晓了.倘使要写到文件实际上要加括号,那一个跟linux有一个相似.
R:\>(echo 1111 &echo 2222 ) > aa.txt

–//很分明改动口令的下令暴光无遗.

R:\>cat aa.txt
1111
2222

R:\>cat aa.txt
1111
2222

4.测试password修改口令:
–//在client端登录,执行如下测试命令:
select sysdate from dual;
password
select Sysdate from dual;

–//这么些倒是正常的意况.

–//这几个倒是正常的处境.

–//在服务器执行:
# Tcpdumpsql cliend_ip
select sysdate from dual
       
………………..SCOTT…..AUTH_SESSKEY……..!…!AUTH_PASSWORD@…@1498887FF997E2D432717C036E8672E9858F261F5A058B6927A9CE4DA137D1AD………AUTH_NEWPASSWORD@…@FD4CD857F51847B1B86CFDC3263776C365CC27A33FACD76763AB40FE3B073052….!…!AUTH_TERMINAL…..IKD84BCP………AUTH_PROGRAM_NM…..sqlplus.exe………AUTH_MACHINE…..WORKGROUP\IKD84BCP………AUTH_PID       
…    
1404:5880………AUTH_SID!…!Administrator………AUTH_ALTER_SESSION……ALTER
SESSION SET NLS_LANGUAGE= ‘AMERICAN’ NLS_TERRITORY= ‘AMERICA’
NLS_CURRENCY= ‘$’ NLS_ISO_CURRENCY= ‘AMERICA’
NLS_NUMERIC_CHARACTERS= ‘.,’ NLS_CALENDAR= ‘GREGORIAN’
NLS_DATE_FORMAT= ‘YYYY-MM-DD HH24:MI:SS’ NLS_DATE_LANGUAGE=
‘AMERICAN’ NLS_SORT= ‘BINA.RY’ TIME_ZONE= ‘+08:00’ NLS_COMP= ‘BINARY’
NLS_DUAL_CURRENCY= ‘$’ NLS_TIME_FORMAT= ‘HH.MI.SSXFF AM’
NLS_TIMESTAMP_FORMAT= ‘YYYY-MM-DD HH24:MI:SS.FF’
NLS_TIME_TZ_FORMAT= ‘HH.MI.SSXFF AM TZR’ NLS_TIMESTAMP_TZ_FORMAT=
‘YYYY-MM-DD HH24:MI:SS.FF TZH:TZM’
select Sysdate from dual

2.用到这一个特性可以通过管道传输命令给sqlplus.

2.施用那些特点可以经过管道传输命令给sqlplus.

–//做一些格式化处理
………………..SCOTT…..AUTH_SESSKEY……..!…!AUTH_PASSWORD@…@1498887FF997E2D432717C036E8672E9858F261F5A058B6927A9CE4DA137D1AD
………AUTH_NEWPASSWORD@…@FD4CD857F51847B1B86CFDC3263776C365CC27A33FACD76763AB40FE3B073052….!…!AUTH_TERMINAL…..IKD84BCP
………AUTH_PROGRAM_NM…..sqlplus.exe………AUTH_MACHINE…..WORKGROUP\IKD84BCP………AUTH_PID       
…     
1404:5880………AUTH_SID!…!Administrator………AUTH_ALTER_SESSION……ALTER
SESSION SET NLS_LANGUAGE= ‘AMERICAN’
NLS_TERRITORY= ‘AMERICA’ NLS_CURRENCY= ‘$’ NLS_ISO_CURRENCY=
‘AMERICA’ NLS_NUMERIC_CHARACTERS= ‘.,’
NLS_CALENDAR= ‘GREGORIAN’ NLS_DATE_FORMAT= ‘YYYY-MM-DD HH24:MI:SS’
NLS_DATE_LANGUAGE= ‘AMERICAN’ NLS_SORT= ‘BINA.RY’ TIME_ZONE=
‘+08:00’
NLS_COMP= ‘BINARY’ NLS_DUAL_CURRENCY= ‘$’ NLS_TIME_FORMAT=
‘HH.MI.SSXFF AM’ NLS_TIMESTAMP_FORMAT= ‘YYYY-MM-DD HH24:MI:SS.FF’
NLS_TIME_TZ_FORMAT= ‘HH.MI.SSXFF AM TZR’ NLS_TIMESTAMP_TZ_FORMAT=
‘YYYY-MM-DD HH24:MI:SS.FF TZH:TZM’

R:\>echo set timing off head off; &echo select  sysdate  from
dual;
set timing off head off;
select  sysdate  from dual;

R:\>echo set timing off head off; &echo select  sysdate  from
dual;
set timing off head off;
select  sysdate  from dual;

SYS@book> column SPARE4 format a70
SYS@book> select name,password,spare4 from user$ where
name=’SCOTT’;
NAME  PASSWORD                       SPARE4

R:\>echo set timing off head off; &echo select  sysdate  from dual; 
| sqlplus -s scott/book@78
set timing off head off;

R:\>echo set timing off head off; &echo select  sysdate  from dual; 
| sqlplus -s scott/book@78
set timing off head off;


SYSDATE

2017-12-25 10:06:33

–//晕!!明显set timing off head
off;那行没有经过管道出口,而是平素出口到显示器.因为只要输入管道,展现的应该是尚未sysdate字段名.
–//仔细看后面的例证才察觉实际上echo 1111 &echo 2222 | cat
输出1111走显示器,而输出2222管道,看上去突显是例行的.
–//也就是要2行都通过管道必须使用括号.修改如下.

R:\>(echo set timing off head off; &echo select  sysdate  from dual;
) | sqlplus -s scott/book@78
2017-12-25 10:08:59

–//我google发现此外的写法,在&前加盟^.
R:\>echo set timing off head off;^&echo select  sysdate  from dual; 
| sqlplus -s scott/book@78
2017-12-25 10:11:57

–//确实是Ok了,可是别的的问题来了:
R:\>echo set timing off head off;^&echo select  sysdate  from dual; 
| cat
set timing off head off;
select  sysdate  from dual;

R:\>echo set timing off head off;^&echo select  sysdate  from dual;
> aa.txt

R:\>cat aa.txt
set timing off head off;&echo select  sysdate  from dual;

–//不能驾驭windows的批处理,通过管道出口2行.而利用文件吸纳显示的是set
timing off head off;&echo select  sysdate  from dual;
–//重定向到文件时^实际上转义&.
set timing off head off; &echo select  sysdate  from dual;

–//而实际上那样进行是分外的.
R:\>cat aa.txt | sqlplus -s scott/book@78
亚洲必赢app官方下载,Enter value for echo:
SP2-0546: User requested Interrupt or EOF detected.

–//依然不佳通晓windows的批处理的微妙!!在自身感觉最佳的不二法门仍旧加括号相比好领悟一些.
–//实际上假使能很好了然链接
–//就能很好精通.

–//不过只要echo里面有括号问题又来了:
R:\>(echo set timing off head off;&echo select  (sysdate+1)  from
dual;)  | sqlplus -s scott/book@78
这会儿不应有 from。

–//也就是)要转义,要转义3次.碰到那种情景频频增添^就是了.
R:\>(echo set timing off head off;&echo select  (sysdate+1^^^)  from
dual;)  | sqlplus -s scott/book@78
2017-12-26 11:16:33

–//而后面那种办法就大概了.
R:\>echo set timing off head off;^&echo select  (sysdate+1)  from
dual; |   sqlplus -s scott/book@78
2017-12-26 11:17:35

–//在我看来windows批处理真是变态加变态..

SYSDATE

2017-12-25 10:06:33

–//晕!!明显set timing off head
off;那行没有经过管道出口,而是直接出口到显示屏.因为一旦输入管道,突显的应有是尚未sysdate字段名.
–//仔细看前面的例子才发觉实际上echo 1111 &echo 2222 | cat
输出1111走显示屏,而输出2222管道,看上去展现是例行的.
–//也就是要2行都因而管道必须使用括号.修改如下.

R:\>(echo set timing off head off; &echo select  sysdate  from dual;
) | sqlplus -s scott/book@78
2017-12-25 10:08:59

–//我google发现此外的写法,在&前出席^.
R:\>echo set timing off head off;^&echo select  sysdate  from dual; 
| sqlplus -s scott/book@78
2017-12-25 10:11:57

–//确实是Ok了,可是其余的问题来了:
R:\>echo set timing off head off;^&echo select  sysdate  from dual; 
| cat
set timing off head off;
select  sysdate  from dual;

R:\>echo set timing off head off;^&echo select  sysdate  from dual;
> aa.txt

R:\>cat aa.txt
set timing off head off;&echo select  sysdate  from dual;

–//不能驾驭windows的批处理,通过管道出口2行.而选择文件吸纳呈现的是set
timing off head off;&echo select  sysdate  from dual;
–//重定向到文件时^实际上转义&.
set timing off head off; &echo select  sysdate  from dual;

–//而实际上那样进行是老大的.
R:\>cat aa.txt | sqlplus -s scott/book@78
Enter value for echo:
SP2-0546: User requested Interrupt or EOF detected.

–//照旧不好通晓windows的批处理的神秘!!在自家感觉到最佳的艺术仍然加括号相比好通晓一些.
–//实际上如若能很好驾驭链接
–//就能很好通晓.

–//可是假设echo里面有括号问题又来了:
R:\>(echo set timing off head off;&echo select  (sysdate+1)  from
dual;)  | sqlplus -s scott/book@78
那儿不该 from。

–//也就是)要转义,要转义3次.蒙受那种场馆频频充实^就是了.
R:\>(echo set timing off head off;&echo select  (sysdate+1^^^)  from
dual;)  | sqlplus -s scott/book@78
2017-12-26 11:16:33

–//而后面那种办法就概括了.
R:\>echo set timing off head off;^&echo select  (sysdate+1)  from
dual; |   sqlplus -s scott/book@78
2017-12-26 11:17:35

–//在我看来windows批处理真是变态加变态..


SCOTT 0EDE56329E1D82EA              
S:52BD300CE604E12EB9D6731005A8294E77D62C898D4C7CB2827DFCAE90AC

–//从那里看看,改变口令使用password尤其安全一些.

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图