一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

正方加密解密算法及獲取密鑰

 quasiceo 2014-08-13

正方加密解密算法及獲取密鑰

作者: BccSafe 分類: Code[Delphi] 發(fā)布時(shí)間: 2014-07-18 01:22 ? 6沒(méi)有評(píng)論

 這學(xué)期掛了2門,很是不爽

于是乎重操舊業(yè),話說(shuō)我已經(jīng)很久沒(méi)碰滲透測(cè)試這方面的東西了

各種坎坷…

具體細(xì)節(jié)以后再寫

拿到系統(tǒng)管理員的密文后,百度他的算法資料 

也不用反編譯那個(gè)zjdx.dll了,網(wǎng)上資料一片一片的

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Public Function jiam(ByVal PlainStr As String, ByVal key As String) As String
        Dim strChar, KeyChar, NewStr As String
        Dim Pos As Integer
        Dim i, intLen As Integer
        Dim Side1, Side2 As String
        Pos = 1
        For i = 1 To Len(PlainStr)
            strChar = Mid(PlainStr, i, 1)
            KeyChar = Mid(key, Pos, 1)
            If ((Asc(strChar) Xor Asc(KeyChar)) < 32) Or ((Asc(strChar) Xor Asc(KeyChar)) > 126) Or (Asc(strChar) < 0) Or (Asc(strChar) > 255) Then
                NewStr = NewStr & strChar
            Else
                NewStr = NewStr & Chr(Asc(strChar) Xor Asc(KeyChar))
            End If
            If Pos = Len(key) Then Pos = 0
            Pos = Pos + 1
        Next
        If Len(NewStr) Mod 2 = 0 Then
            Side1 = StrReverse(Left(NewStr, CInt((Len(NewStr) / 2))))
            Side2 = StrReverse(Right(NewStr, CInt((Len(NewStr) / 2))))
            NewStr = Side1 & Side2
        End If
        jiam = NewStr
    End Function
public string jiemi(string PlainStr, string key)
{
      string text3;
      int num2 = 1;
      if ((Strings.Len(PlainStr) % 2) == 0)
      {
            string text4 = Strings.StrReverse(Strings.Left(PlainStr, (int) Math.Round(((double) Strings.Len(PlainStr)) / 2)));
            string text5 = Strings.StrReverse(Strings.Right(PlainStr, (int) Math.Round(((double) Strings.Len(PlainStr)) / 2)));
            PlainStr = text4 + text5;
      }
      int num3 = Strings.Len(PlainStr);
      for (int num1 = 1; num1 <= num3; num1++)
      {
            string text6 = Strings.Mid(PlainStr, num1, 1);
            string text2 = Strings.Mid(key, num2, 1);
            if (((((Strings.Asc(text6) ^ Strings.Asc(text2)) < 0x20) | ((Strings.Asc(text6) ^ Strings.Asc(text2)) > 0x7e)) | (Strings.Asc(text6) < 0)) | (Strings.Asc(text6) > 0xff))
            {
                  text3 = text3 + text6;
            }
            else
            {
                  text3 = text3 + StringType.FromChar(Strings.Chr(Strings.Asc(text6) ^ Strings.Asc(text2)));
            }
            if (num2 == Strings.Len(key))
            {
                  num2 = 0;
            }
            num2++;
      }
      return text3;
}

 

奉上delphi版的方正加密解密算法(他的算法很渣,看看就好了)

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//uses StrUtils;
function RightCopy(S: string; Index, count: Integer): string;
begin
  Result := Copy(S,Length(S)-count+1-(Index-1),count);
end;
function jiami(PlainStr, key: string): string;
var
  StrChar, Keychar: Char;
  Pos: Integer;
  i : Integer;
  StrLeft, StrRight: String;
begin
  Pos := 1;
  for i := 1 to Length(PlainStr) do
  begin
    StrChar := copy(PlainStr, i, 1)[1];
    KeyChar := copy(key, Pos, 1)[1];
    if ((ord(StrChar) Xor ord(KeyChar)) < 32) Or
      ((ord(StrChar) Xor ord(KeyChar)) > 126) Or
      (ord(StrChar) > 255) Then   //ord(StrChar) < 0 永遠(yuǎn)為false 去掉了
      Result := Result + StrChar
    Else
      Result := Result + Char(ord(StrChar) Xor ord(KeyChar));
    if Pos = Length(key) then Pos := 0;
    Inc(Pos);
  end;
  If Length(Result) Mod 2 = 0 Then
  begin
    StrLeft := ReverseString(copy(Result, 0, Round(Length(Result) / 2)));
    StrRight := ReverseString(RightCopy(Result, 1, Round(Length(Result) / 2)));
    Result := StrLeft + StrRight;
  end;
end;
function jiemi(PlainStr, key: string): string;
var
  StrLeft, StrRight: string;
  num2, i : Integer;
  StrChar, Keychar: Char;
begin
  num2 := 1;
  if Length(PlainStr) mod 2 = 0 then
  begin
    StrLeft := ReverseString(copy(PlainStr, 0, Round(Length(PlainStr) / 2)));
    StrRight := ReverseString(RightCopy(PlainStr, 1,
      Round(Length(PlainStr) / 2)));
    PlainStr := StrLeft + StrRight;
  end;
  for i := 1 to Length(PlainStr) do
  begin
    StrChar := copy(PlainStr, i, 1)[1];
    Keychar := copy(key, num2, 1)[1];
    if (((((ord(StrChar) Xor ord(Keychar)) < 32) Or ((ord(StrChar) Xor ord(Keychar)) >
      126)) ) Or (ord(StrChar) > 255)) then  //ord(StrChar) < 0 永遠(yuǎn)為false 去掉了
      Result := Result + StrChar
    else
      Result := Result + Char(ord(StrChar) xor ord(Keychar));
    if num2 = Length(key) then num2 := 0;
    Inc(num2);
  end;
end;

 

 

然后問(wèn)題出現(xiàn)了,我們學(xué)校的密鑰并不是網(wǎng)上流傳的Acxylf365jw

渣渣表示只能繼續(xù)百度- -

發(fā)現(xiàn)核攻擊寫了一片關(guān)于這個(gè)的算法

GET!

根據(jù)他寫的,改的delphi版的GetKey

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function GetKey(PlainStr: String; Pass: String): String;
var
  StrChar, Keychar: Char;
  Pos: Integer;
  i: Integer;
  StrLeft, StrRight: String;
begin
  Pos := 0;
  If Length(PlainStr) Mod 2 = 0 Then
  begin
    StrLeft := ReverseString(copy(PlainStr, 0, Round(Length(PlainStr) / 2)));
    StrRight := ReverseString(RightCopy(PlainStr, 1, Round(Length(PlainStr) / 2)));
    PlainStr := StrLeft + StrRight;
  end;
  for i := 0 to Length(PlainStr) - 1 do
  begin
    StrChar := Copy(PlainStr, i, 1)[1];
    KeyChar := Copy(Pass, Pos, 1)[1];
    If StrChar = KeyChar Then
      Result := Result + '*'
    else
      Result := Result + Char(ord(StrChar) Xor ord(KeyChar));
    Pos := Pos + 1;
  end;
end;

 

從數(shù)據(jù)庫(kù)里找了點(diǎn)數(shù)據(jù)出來(lái)(有些賬號(hào)密碼就是賬號(hào)名)

成功拿到了密鑰Encrypt01

本文出自 BccSafe's Blog,轉(zhuǎn)載時(shí)請(qǐng)注明出處及相應(yīng)鏈接。

本文永久鏈接: http://www./?p=569

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多

    日韩精品中文字幕亚洲| 亚洲一区二区三区免费的视频| 日韩人妻欧美一区二区久久| 亚洲国产中文字幕在线观看| 伊人久久青草地婷婷综合| 国产三级黄片在线免费看| 国产色偷丝袜麻豆亚洲| 欧美特色特黄一级大黄片| 欧洲一区二区三区自拍天堂| 国产成人精品一区在线观看| 精品一区二区三区不卡少妇av| 日本高清不卡一二三区| 中文字幕欧美视频二区| 婷婷伊人综合中文字幕| 黑色丝袜脚足国产一区二区| 国产免费一区二区不卡| 偷拍洗澡一区二区三区| 欧美成人黄色一级视频| 国产一级不卡视频在线观看| 亚洲国产精品av在线观看| 国产亚洲欧美自拍中文自拍| 亚洲天堂精品一区二区| 成人国产激情福利久久| 欧美成人高清在线播放| 国产免费黄片一区二区| 中文字幕禁断介一区二区| 日韩精品日韩激情日韩综合| 国产精品一区二区日韩新区| 日本高清一区免费不卡| 亚洲综合激情另类专区老铁性| 亚洲精品偷拍视频免费观看| 欧洲日本亚洲一区二区| 日韩欧美一区二区久久婷婷| 亚洲一区二区三区三州| 免费福利午夜在线观看| 亚洲二区欧美一区二区| 精产国品一二三区麻豆| 精品人妻一区二区三区免费看| 男人和女人草逼免费视频| 色无极东京热男人的天堂| 精品国产成人av一区二区三区|