code
stringlengths 1
1.05M
| repo_name
stringlengths 6
83
| path
stringlengths 3
242
| language
stringclasses 222
values | license
stringclasses 20
values | size
int64 1
1.05M
|
|---|---|---|---|---|---|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_38588
{
meta:
date="2024-12-06"
openharmony_sa=""
cve="CVE-2024-38588"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {93 00 00 B4 ?? 4D FE 97 E0 03 13 AA 1D 00 00 94}
condition:
$fix and console.log("CVE-2024-38588 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/09/CVE-2024-38588/TestCaseRule-CVE-2024-38588.yara
|
YARA
|
unknown
| 1,020
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_38601
{
meta:
date = "2023-03-08"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {?? ?? 50 94 F9 03 00 AA E0 03 17 AA ?? ?? 00 94 E0 03 18 AA E1 03 19 AA ?? ?? 50 94}
condition:
$fix and console.log("OpenHarmony-CVE-2024-38601 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/09/CVE-2024-38601/TestCaseRule-OpenHarmony-CVE-2024-38601.yara
|
YARA
|
unknown
| 1,083
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_5535
{
meta:
date="2024-11-15"
openharmony_sa=""
cve="CVE-2024-5535"
affected_files="/system/lib/chipset-pub-sdk/libssl_openssl.z.so"
strings:
$fix = {?? F1 01 00 ?? F8 00 00 0B 70 ?? D4}
condition:
$fix and console.log("CVE-2024-5535 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/09/CVE-2024-5535/TestCaseRule-CVE-2024-5535.yara
|
YARA
|
unknown
| 1,038
|
/*
*Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*http://www.apache.org/licenses/LICENSE-2.0
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_42114
{
meta:
date = "2024-07-12"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {69 6E 6F 64 65 20 28 69 6E 6F 3D}
$fix = {69 6E 6F 64 65 20 28 69 6E 6F 3D 25 6C 78 29 20 68 61 73 20 63 6F 72 72 75 70 74 65 64 20 69 5F 78 61 74 74 72 5F 6E 69 64 3A 20 25 75 2C 20 72 75 6E 20 66 73 63 6B 20 74 6F 20 66 69 78 2E 00}
condition:
((not $vul) or $fix) and console.log("OpenHarmony-CVE-2024-39467 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/09/OpenHarmony-CVE-2024-39467/TestCaseRule-OpenHarmony-CVE-2024-39467.yara
|
YARA
|
unknown
| 1,184
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule CVE_2023_52672
{
meta:
date = "2024-12-18"
openharmony_sa = ""
cve = "CVE-2023-52672"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {f8 37 b5 4e 14 12 74 92 00 b9 74 9a 00 b9}
condition:
(not $vul) and console.log("CVE-2023-52672 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/10/CVE-2023-52672/TestCaseRule-CVE-2023-52672.yara
|
YARA
|
unknown
| 1,029
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_35947
{
meta:
date = "2024-05-19"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = "parse err after word:%d=%s\n"
condition:
$fix and console.log("OpenHarmony-CVE-2024-35947 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/10/CVE-2024-35947/TestCaseRule-OpenHarmony-CVE-2024-35947.yara
|
YARA
|
unknown
| 1,003
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_40971
{
meta:
date="2024-12-10"
openharmony_sa=""
cve="CVE_2024_40971"
affected_files=""
strings:
$fix = {68 92 47 B9 ?? ?? ?? ?? 49 00 80 52 75 C2 1F 39 7F E2 1F 39 F5 0B 40 F9}
condition:
$fix and console.log("CVE_2024_40971 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/10/CVE-2024-40971/CVE-2024-40971.yara
|
YARA
|
unknown
| 984
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_41035
{
meta:
date="2024-12-19"
openharmony_sa=""
cve="CVE-2024-41035"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix="config %d interface %d altsetting %d has an endpoint descriptor with address 0x%X, changing to 0x%X"
condition:
$fix and console.log("CVE-2024-41035 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/10/CVE-2024-41035/TestCaseRule-CVE-2024-41035.yara
|
YARA
|
unknown
| 1,068
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestcaseRule_OpenHarmony_CVE-2024-41087
{
meta:
date = "2024-10"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {E0 03 13 AA ?? ?? DF 97 04 00 00 14}
$vul = {E0 03 13 AA F5 76 DF 97}
condition:
((not $vul) and $fix) and console.log("CVE-2024-41087 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/10/CVE-2024-41087/TestcaseRule-OpenHarmony-CVE-2024-41087.yara
|
YARA
|
unknown
| 1,057
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_42115
{
meta:
date="2024-10"
openharmony_sa=""
cve="CVE_2024_42115"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {60 C2 01 91 ?? ?? F8 97}
$fix = {60 C2 01 91 7F 2E 00 F9 ?? ?? F8 97}
condition:
((not $vul) or $fix) and console.log("CVE-2024-42115 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/10/CVE_2024_42115/TestCaseRule-CVE-2024-42115.yara
|
YARA
|
unknown
| 1,087
|
/*
*Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*http://www.apache.org/licenses/LICENSE-2.0
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_42114
{
meta:
date = "2024-09-26"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {A8 82 23 91 F3 03 00 AA 08 FD DF C8 16 01 40 F9 C8 52 41 39}
$fix = {D6 C2 00 91 F3 03 00 AA E0 03 16 AA 0F 40 51 94 A8 82 23 91 09 41 38 D5 08 FD DF C8 E1 03 13 AA}
condition:
((not $vul) or $fix) and console.log("OpenHarmony-CVE-2024-42114 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/10/OpenHarmony-CVE-2024-42114/TestCaseRule-OpenHarmony-CVE-2024-42114.yara
|
YARA
|
unknown
| 1,113
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_26684
{
meta:
date = "2024-02-19"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = "Read Rx Descriptor Parity checker Error"
condition:
$fix and console.log("OpenHarmony-CVE-2024-26684 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2024/12/CVE-2024-26684/TestCaseRule-OpenHarmony-CVE-2024-26684.yara
|
YARA
|
unknown
| 1,016
|
/*
* Copyright (c) 2025 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_54030
{
meta:
date = "2025-01-22"
openharmony_sa = ""
cve = "CVE-2024-54030"
// 这是你提取出来的那个文件名
affected_files = "/system/lib/libsoftbus_server.z.so"
strings:
// 特征:这是补丁中新增的字符串。
// 如果文件里有这句话,说明打过补丁了。
$fix = "lock list err"
condition:
// 逻辑:如果找到了 $fix 字符串,打印 pass (通过测试)
$fix and console.log("CVE-2024-54030 testcase pass")
}
|
2301_80000730/security_1307
|
vulntest/SSTSTestcases/2025/01/CVE-2024-54030/CVE-2024-54030.yara
|
YARA
|
unknown
| 1,181
|
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
|
2301_80000730/security_1307
|
vulntest/vultraining/entry/hvigorfile.ts
|
TypeScript
|
unknown
| 234
|
import { appTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
|
2301_80000730/security_1307
|
vulntest/vultraining/hvigorfile.ts
|
TypeScript
|
unknown
| 234
|
rule CVE_2025_21817_Netfilter_InfoLeak
{
meta:
cve = "CVE-2025-21817"
description = "Linux kernel netfilter out-of-bounds read info leak"
author = "汪娅辰(学生 STSS 贡献)"
date = "2025-11-28"
severity = "Medium"
category = "kernel"
strings:
$s1 = "nf_hook_slow" ascii
$s2 = "xt_find_table_lock" ascii
$s3 = "nf_register_net_hook" ascii
$s4 = "skb_copy_bits" ascii
$hex1 = { 6E 66 5F 68 6F 6F 6B }
condition:
3 of ($s*) or ($hex1)
}
Signed-off-by: 汪娅辰 <2301_80000730@noreply.gitcode.com>
|
2301_80000730/security_1308
|
cve_2025_21817.yara
|
YARA
|
unknown
| 661
|
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule TestCaseRule_OpenHarmony_SA_2023_0101
{
meta:
date = "2023-02-13"
openharmony_sa = "OpenHarmony-SA-2023-0101"
cve = "CVE-2023-0035"
file = "libsoftbus_client.z.so"
strings:
$fix = "write InterfaceToken failed!"
condition:
$fix and console.log("OpenHarmony-SA-2023-0101 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/01/OpenHarmony-SA-2023-0101/TestCaseRule-OpenHarmony-SA-2023-0101.yara
|
YARA
|
unknown
| 1,012
|
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule TestCaseRule_OpenHarmony_SA_2023_0102
{
meta:
date = "2023-02-17"
openharmony_sa = "OpenHarmony-SA-2023-0102"
cve = "CVE-2023-0036"
file = "libinputmethod_service.z.so"
strings:
/*
.text:00045E0E LDRB.W R3, [SP,#0x68+var_34]
.text:00045E12 ADD R0, PC ;
.text:00045E14 LDR R2, [SP,#0x68+var_30]
*/
$fix = {9D F8 34 30 78 44 0E 9A}
condition:
$fix and console.log("OpenHarmony-SA-2023-0102 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/01/OpenHarmony-SA-2023-0102/TestCaseRule-OpenHarmony-SA-2023-0102.yara
|
YARA
|
unknown
| 1,207
|
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule TestCaseRule_OpenHarmony_SA_2023_0201
{
meta:
date = "2023-02"
openharmony_sa = "OpenHarmony-SA-2023-0201"
cve = "CVE-2023-0083"
severity = "low"
file = "libace_engine_declarative_ark.z.so" //受影响于OpenHarmony-v3.1-Release到OpenHarmony-v3.1.5-Release
strings:
$fix = "The number of argument is less than 1, or the argument is not array." //更新后字符串
condition:
(elf.machine == elf.EM_ARM) and $fix and console.log("OpenHarmony-SA-2023-0201 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/02/OpenHarmony-SA-2023-0201/TestCaseRule-OpenHarmony-SA-2023-0201.yara
|
YARA
|
unknown
| 1,197
|
/*
* Copyright (c) 2024 Beijing University Of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2022_4450 {
meta:
date = "2023-1-15"
file = "/system/lib/libhukssdk.z.so"
openharmony_sa = ""
strings:
$original_pattern = {08 46 DF 22 7C 44 21 46 82 F0 8A ED 01 98 21 46 DF 22 00 68 82 F0 84 ED}
$new_pattern = { 08 46 31 46 DF 22 82 F0 92 E8 00 20 31 46 20 60 DF 22 02 9C 20 68 82 F0 8A E8 }
condition:
((not $original_pattern) and $new_pattern) and console.log("CVE_2022_4450 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/03/CVE-2022-4450/TestCaseInfo-CVE-2022-4450.yara
|
YARA
|
unknown
| 1,137
|
/*
* Copyright (c) 2024 BUPT.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule TestCaseRule_CVE_2023_23914
{
meta:
date="2023-03"
openharmony_sa=""
cve="CVE-2023-23914"
affected_files="libhttp.z.so"
path ="rk3568/lib.unstripped/communication/netstack/libhttp.z.so"
strings:
$fix = "Reject response due to more than %u content encodings"
condition:
$fix and console.log("CVE-2023-23914 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/03/CVE-2023-23914/TestCaseRule-CVE-2023-23914.yara
|
YARA
|
unknown
| 989
|
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule TestCaseRule_OpenHarmony_SA_2023_0301
{
meta:
date = "2023-03-08"
openharmony_sa = "OpenHarmony-SA-2023-0301"
cve = "CVE-2023-24465"
severity = "medium"
file = "libwifi_scan_ability.z.so"
func = "WifiScanStub::OnScanByParams"
strings:
$features = "run OnScanByParams code %{public}u, datasize %{public}zu" nocase wide ascii
/* 3.1.4 vul code
.text:0000B0D0 01 46 MOV R1, R0
.text:0000B0D2 20 46 MOV R0, R4
*/
$vul = {01 46 ?? 46}
/* 3.1.4 with patch
.text:0000B0DA 7D 44 ADD R5, PC ; ""
.text:0000B0DC 08 BF IT EQ
.text:0000B0DE 29 46 MOVEQ R1, R5
*/
$fix = {7? 44 08 BF ?? 46}
condition:
(elf.machine == elf.EM_ARM) and $features and ((not $vul) or $fix) and console.log("OpenHarmony-SA-2023-0301 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/03/OpenHarmony-SA-2023-0301/TestCaseRule-OpenHarmony-SA-2023-0301.yara
|
YARA
|
unknown
| 1,828
|
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule TestCaseRule_OpenHarmony_SA_2023_0302
{
meta:
date = "2023-03-10"
openharmony_sa = "OpenHarmony-SA-2023-0302"
file = "libappexecfwk_core.z.so"
path = "rk3568/appexecfwk/bundle_framework/libappexecfwk_core.z.so"
strings:
$fix = "ERR_APPEXECFWK_PARSE_PROFILE_PROP_SIZE_CHECK_ERROR"
condition:
$fix and console.log("OpenHarmony-SA-2023-0302 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/03/OpenHarmony-SA-2023-0302/TestCaseRule-OpenHarmony-SA-2023-0302.yara
|
YARA
|
unknown
| 1,043
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2022_30787
{
meta:
date = "2024-01-15"
file = "/system/bin/fsck.ntfs"
strings:
$fix = "name in inode %lld"
condition:
$fix and console.log("TestCaseRule-OpenHarmony-CVE-2022-30787 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2023/04/OpenHarmony-CVE-2022-30787/TestCaseRule-OpenHarmony-CVE-2022-30787.yara
|
YARA
|
unknown
| 973
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_2398
{
meta:
date="2024-11-11"
openharmony_sa=""
cve="CVE-2024-2398"
affected_files="/system/lib/libcurl_shared.z.so"
strings:
$fix= {F0 B5 ?? B0 ?? 46 D0 F8 ?? ?? ?? 4D ?? 44 60 B1}
condition:
$fix and console.log("CVE-2024-2398 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/06/CVE-2024-2398/TestCaseRule-CVE-2024-2398.yara
|
YARA
|
unknown
| 1,004
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_2478
{
meta:
date="2024-11-11"
openharmony_sa=""
cve="CVE-2024-2478"
affected_files="/system/lib/libwpa_sys.z.so"//in 4.1.x, and "/system/lib/libwpa.z.so" in 4.0.x
strings:
$fixstring= "EAP-PEAP: Require Phase 2 authentication for initial connection"
condition:
$fixstring and console.log("CVE-2024-2478 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/06/CVE-2024-2478/TestCaseRule-CVE-2024-2478.yara
|
YARA
|
unknown
| 1,077
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_26883
{
meta:
date="2024-12-05"
openharmony_sa=""
cve="CVE-2024-26883"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix_4_0_x = {89 35 01 D0 29 85 4C B9 3F 0D 55 6B 03 FE FF 54 14 00 00 14}
$fix_4_1_x = {1F 01 09 6B 69 00 00 54 D4 00 80 92 EA FF FF 17}
condition:
($fix_4_0_x or $fix_4_1_x) and console.log("CVE-2024-26883 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/07/CVE-2024-26883/TestCaseRule-CVE-2024-26883.yara
|
YARA
|
unknown
| 1,124
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_26884
{
meta:
date="2024-12-05"
openharmony_sa=""
cve="CVE-2024-26884"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {1F 01 09 6B 48 03 00 54 E8 03 08 2A}
condition:
$fix and console.log("CVE-2024-26884 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/07/CVE-2024-26884/TestCaseRule-CVE-2024-26884.yara
|
YARA
|
unknown
| 1,006
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule TestCaseRule_CVE_2024_27004
{
meta:
date = "2024-12-23"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {08 20 80 D2 49 04 80 52 A8 D5 FB F2 ?? 16 01 ?? 00 80 ?? 91}
condition:
$fix and console.log("CVE-2024-27004 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/07/CVE-2024-27004/TestCaseRule-CVE-2024-27004.yara
|
YARA
|
unknown
| 1,021
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_27038
{
meta:
date="2024-05-01"
openharmony_sa=""
cve="CVE_2024_27038"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {1f 04 40 b1 48 00 00 54 00 00 40 f9}
$fix = {1f 04 40 b1 68 00 00 54 48 00 00 54 00 00 40 f9}
condition:
((not $vul) or $fix) and console.log("CVE_2024_27038 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/07/CVE-2024-27038/CVE-2024-27038.yara
|
YARA
|
unknown
| 1,081
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2023_52739
{
meta:
date="2025-06-30"
openharmony_sa=""
cve="CVE_2023_52739"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {6a 16 42 f9 4a 21 00 91 15 00 00 14}
$fix = {68 1a 42 f9 17 05 00 f9 1b 00 00 14}
condition:
((not $vul) or $fix) and console.log("CVE_2024_52739 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2023-52739/TestCaseRule-CVE-2023-52739.yara
|
YARA
|
unknown
| 1,069
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_52781
{
meta:
date="2024-05-21"
openharmony_sa=""
cve="CVE_2023_52781"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {6a 16 42 f9 4a 21 00 91 15 00 00 14}
$fix = {68 1a 42 f9 17 05 00 f9 1b 00 00 14}
condition:
((not $vul) or $fix) and console.log("CVE_2024_27038 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2023-52781/CVE-2023-52781.yara
|
YARA
|
unknown
| 1,069
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_52835
{
meta:
data="2024-12-17"
openharmony_sa=""
cve="CVE-2024-52835"
file="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$b_version = {C8 7E 7D 93 08 05 00 D1 1F 05 40 F1}
$b_version2 = {08 FD 4C D3 08 11 C0 DA 1F D5 00 71}
condition:
$b_version and $b_version2 and console.log("CVE-2023-52835 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2023-52835/TestCaseRule-CVE-2023-52835.yara
|
YARA
|
unknown
| 1,075
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2023_52868
{
meta:
date = "2024-12-27"
file = ""
strings:
$fix = {FA 03 16 AA ?2 6F 00 ?0 42 ?? ?? 91 81 02 80 52 43 87 44 B8 E0 03 1A AA ?? B? E4 97}
condition:
$fix and console.log("TestCaseRule_CVE_2023_52868 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2023-52868/TestCaseRule-CVE-2023-52868.yara
|
YARA
|
unknown
| 1,007
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_26733
{
meta:
date="2024-12-23"
openharmony_sa=""
cve="CVE-2024-26733"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {61 62 03 91 1F 39 00 71 02 31 89 1A}
condition:
$fix and console.log("CVE-2024-26733 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-26733/TestCaseRule-CVE-2024-26733.yara
|
YARA
|
unknown
| 1,006
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_26934
{
meta:
date="2024-12-05"
openharmony_sa=""
cve="CVE-2024-26934"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {?? E0 FF 97 E0 03 14 AA ?? ?? DB 97}
condition:
$fix and console.log("CVE-2024-26934 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-26934/TestCaseRule-CVE-2024-26934.yara
|
YARA
|
unknown
| 1,006
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_27399
{
meta:
date = "2024-05-23"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
openharmony_sa=""
cve="CVE_2024_27399"
strings:
$vul = {75 02 40 F9 ?? 05 10 37 }
$fix = {75 02 40 F9 ?? 05 10 37 D5 04 00 B4}
condition:
((not $vul) or $fix) and console.log("CVE_2024_27399 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-27399/TestCaseRule-CVE-2024-27399.yara
|
YARA
|
unknown
| 1,098
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_28182
{
meta:
date="2024-11-15"
openharmony_sa=""
cve="CVE-2024-28182"
affected_files="/system/lib/platformsdk/libnghttp2_shared.z.so"
strings:
$fixstring = "Too many CONTINUATION frames following a HEADER frame"
condition:
$fixstring and console.log("CVE-2024-28182 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-28182/TestCaseRule-CVE-2024-28182.yara
|
YARA
|
unknown
| 1,069
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_35789 {
meta:
date = "20240508"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {0? 1D 00 94}
$unfix = {A4 1D 00 94}
/* 4.1.3 版本特殊判断 */
$s = {B4 34 00 94}
condition:
$fix and ( not $unfix or $s ) and console.log("CVE-2024-35789 pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-35789/CVE-2024-35789.yara
|
YARA
|
unknown
| 1,055
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestcaseRule_OpenHarmony_CVE_2024_35822
{
meta:
date = "2024-05-17"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = "USB gadget: queue request to disabled ep 0x%x (%s)\n"
condition:
$fix and console.log("OpenHarmony-CVE-2024-35822 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-35822/TestcaseRule-OpenHarmony-CVE-2024-35822.yara
|
YARA
|
unknown
| 1,027
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_35969
{
meta:
date="2024-06-20"
files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {C0 82 00 91 08 FC DF 88 08 02 00 34}
condition:
$fix and console.log("CVE-2024-35969 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-35969/TestCaseRule-OpenHarmony-CVE-2024-35969.yara
|
YARA
|
unknown
| 975
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule CVE_2024_36008
{
meta:
date="2024-12-18"
openharmony_sa=""
cve="CVE-2024-36008"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix= {C6 06 00 B4 F3 03 00 AA A0 02 80 12 4B 0C 1C 12 7F 81 03 71}
condition:
$fix and console.log("CVE-2024-36008 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-36008/TestCaseRule-CVE-2024-36008.yara
|
YARA
|
unknown
| 1,041
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_36899
{
meta:
date="2024-12-06"
openharmony_sa=""
cve="CVE-2024-36939"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {?? ?? E3 97 60 32 52 F9}
condition:
$fix and console.log("CVE-2024-36899 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-36899/TestCaseRule-CVE-2024-36899.yara
|
YARA
|
unknown
| 993
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_36901
{
meta:
date="2024-12-16"
openharmony_sa=""
cve="CVE-2024-36901"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {CB B0 9B 52 A8 83 1F F8 48 2C 40 F9 08 F9 7F 92 09 01 40 F9 0A 5D 40 F9 4B 58 01 79 48 08 40 F9 49 08 00 F9 EA 05 00 B4 4B A9 41 B9 8B 04 00 35 F5 03 01 AA 6A 72 40 79 4A 02 10 37}
condition:
$fix and console.log("CVE-2024-36901 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-36901/TestCaseRule-CVE-2024-36901.yara
|
YARA
|
unknown
| 1,149
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_36904 {
meta:
date = "20240508"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {B5 FD FF 35}
condition:
$fix and console.log("CVE-2024-36904 pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-36904/CVE-2024-36904.yara
|
YARA
|
unknown
| 940
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_36939
{
meta:
date="2024-12-06"
openharmony_sa=""
cve="CVE-2024-36939"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {?? ?? 37 94 80 00 00 B4 E0 03 13 AA ?? D5 FF 97 04 00 00 14 E0 03 13 AA ?? D5 FF 97 60 01 80 12}
condition:
$fix and console.log("CVE-2024-36939 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-36939/TestCaseRule-CVE-2024-36939.yara
|
YARA
|
unknown
| 1,065
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_36940
{
meta:
date="2024-12-10"
file=""
strings:
$fix={60 2A 40 F9 01 A4 00 ?0 21 ?? ?? 91 E2 03 14 2A ?? ?? 0A 94 E7 FF FF 17}
$nofix={68 0A 40 F9 E0 03 13 AA 01 05 40 F9 02 11 40 B9 10 00 00 94 E0 03 13 AA}
condition:
$fix and not $nofix and console.log("TestCaseRule_CVE-2024-36940 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-36940/TestCaseRule-CVE-2024-36940.yara
|
YARA
|
unknown
| 1,057
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_36941
{
meta:
data = "2024-12-07"
openharmony_sa = ""
cve = "CVE-2024-36941"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix_version = {A9 02 00 B4 77 56 14 9B}
condition:
// 匹配 5.0 版本的机器码并输出信息
$fix_version and console.log("CVE-2024-36941 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-36941/TestCaseRule-CVE-2024-36941.yara
|
YARA
|
unknown
| 1,104
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_4603
{
meta:
date="2024-11-14"
file=""
strings:
$fix={70 B5 05 46 80 68 0C 46 00 28 1C BF E9 68 00 29 02 D1 72 25 19 26 15 E0}
condition:
$fix and console.log("TestCaseRule_CVE_2024_4603 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/08/CVE-2024-4603/TestCaseRule-CVE-2024-4603.yara
|
YARA
|
unknown
| 955
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_25739
{
meta:
date = "2024-02-12"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = "LEB size too small for a volume record"
condition:
$fix and console.log("OpenHarmony-CVE-2024-25739 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-25739/TestCaseRule-OpenHarmony-CVE-2024-25739.yara
|
YARA
|
unknown
| 1,013
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_26585
{
meta:
date = "2024-02-21"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {48 FA FF B4 09 C0 19 D1 2A 00 80 52 2A 01 00 B9 BF 3B 03 D5 89 56 40 F9 1F 01 09 EB F5 17 9F 1A}
$fix = {E0 03 08 AA 81 3A 00 B9 45 EF FF 97}
condition:
((not $vul) or $fix) and console.log("OpenHarmony-CVE-2024-26585 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-26585/TestCaseRule-OpenHarmony-CVE-2024-26585.yara
|
YARA
|
unknown
| 1,140
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE202436270
{
meta:
date="2024-12-29"
openharmony_sa=""
cve="CVE-2024-36270"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {08 FD DF C8 88 01 00 B4 08 41 00 91 08 FD DF C8}
$vul = {08 FD DF C8 08 41 00 91 08 FD DF C8 28 01 00 B4}
condition:
((not $vul) and $fix) and console.log("CVE-2024-36270 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-36270/TestCaseRule-OpenHarmony-CVE-2024-36270.yara
|
YARA
|
unknown
| 1,094
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule CVE_2024_38564
{
meta:
date = "2024-12-18"
openharmony_sa = ""
cve = "CVE-2024-38564"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {e0 03 13 2a ?? ?? ?? ?? 88 06 40 b9 1f 01 00 6b}
condition:
$fix and console.log("CVE-2024-38564 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-38564/TestCaseRule-CVE-2024-38564.yara
|
YARA
|
unknown
| 1,030
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_38577
{
meta:
date="2024-12-06"
openharmony_sa=""
cve="CVE-2024-38577"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {45 5D 41 F9 06 61 41 F9 E0 23 00 91 01 08 80 52 ?? ?? 19 94}
condition:
$fix and console.log("CVE-2024-38577 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-38577/TestCaseRule-CVE-2024-38577.yara
|
YARA
|
unknown
| 1,028
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_38588
{
meta:
date="2024-12-06"
openharmony_sa=""
cve="CVE-2024-38588"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {93 00 00 B4 ?? 4D FE 97 E0 03 13 AA 1D 00 00 94}
condition:
$fix and console.log("CVE-2024-38588 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-38588/TestCaseRule-CVE-2024-38588.yara
|
YARA
|
unknown
| 1,020
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_38601
{
meta:
date = "2023-03-08"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {?? ?? 50 94 F9 03 00 AA E0 03 17 AA ?? ?? 00 94 E0 03 18 AA E1 03 19 AA ?? ?? 50 94}
condition:
$fix and console.log("OpenHarmony-CVE-2024-38601 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-38601/TestCaseRule-OpenHarmony-CVE-2024-38601.yara
|
YARA
|
unknown
| 1,083
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_CVE_2024_5535
{
meta:
date="2024-11-15"
openharmony_sa=""
cve="CVE-2024-5535"
affected_files="/system/lib/chipset-pub-sdk/libssl_openssl.z.so"
strings:
$fix = {?? F1 01 00 ?? F8 00 00 0B 70 ?? D4}
condition:
$fix and console.log("CVE-2024-5535 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/CVE-2024-5535/TestCaseRule-CVE-2024-5535.yara
|
YARA
|
unknown
| 1,038
|
/*
*Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*http://www.apache.org/licenses/LICENSE-2.0
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_42114
{
meta:
date = "2024-07-12"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {69 6E 6F 64 65 20 28 69 6E 6F 3D}
$fix = {69 6E 6F 64 65 20 28 69 6E 6F 3D 25 6C 78 29 20 68 61 73 20 63 6F 72 72 75 70 74 65 64 20 69 5F 78 61 74 74 72 5F 6E 69 64 3A 20 25 75 2C 20 72 75 6E 20 66 73 63 6B 20 74 6F 20 66 69 78 2E 00}
condition:
((not $vul) or $fix) and console.log("OpenHarmony-CVE-2024-39467 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/09/OpenHarmony-CVE-2024-39467/TestCaseRule-OpenHarmony-CVE-2024-39467.yara
|
YARA
|
unknown
| 1,184
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
import "elf"
rule CVE_2023_52672
{
meta:
date = "2024-12-18"
openharmony_sa = ""
cve = "CVE-2023-52672"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {f8 37 b5 4e 14 12 74 92 00 b9 74 9a 00 b9}
condition:
(not $vul) and console.log("CVE-2023-52672 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/CVE-2023-52672/TestCaseRule-CVE-2023-52672.yara
|
YARA
|
unknown
| 1,029
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_35947
{
meta:
date = "2024-05-19"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = "parse err after word:%d=%s\n"
condition:
$fix and console.log("OpenHarmony-CVE-2024-35947 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/CVE-2024-35947/TestCaseRule-OpenHarmony-CVE-2024-35947.yara
|
YARA
|
unknown
| 1,003
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_40971
{
meta:
date="2024-12-10"
openharmony_sa=""
cve="CVE_2024_40971"
affected_files=""
strings:
$fix = {68 92 47 B9 ?? ?? ?? ?? 49 00 80 52 75 C2 1F 39 7F E2 1F 39 F5 0B 40 F9}
condition:
$fix and console.log("CVE_2024_40971 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/CVE-2024-40971/CVE-2024-40971.yara
|
YARA
|
unknown
| 984
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_41035
{
meta:
date="2024-12-19"
openharmony_sa=""
cve="CVE-2024-41035"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix="config %d interface %d altsetting %d has an endpoint descriptor with address 0x%X, changing to 0x%X"
condition:
$fix and console.log("CVE-2024-41035 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/CVE-2024-41035/TestCaseRule-CVE-2024-41035.yara
|
YARA
|
unknown
| 1,068
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestcaseRule_OpenHarmony_CVE-2024-41087
{
meta:
date = "2024-10"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {E0 03 13 AA ?? ?? DF 97 04 00 00 14}
$vul = {E0 03 13 AA F5 76 DF 97}
condition:
((not $vul) and $fix) and console.log("CVE-2024-41087 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/CVE-2024-41087/TestcaseRule-OpenHarmony-CVE-2024-41087.yara
|
YARA
|
unknown
| 1,057
|
/* * Copyright (c) 2024 Beijing University of Posts and Telecommunications.
* * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* * http://www.apache.org/licenses/LICENSE-2.0
* * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestcaseRule_OpenHarmony_CVE_2024_42236
{
meta:
date = "2024-10"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = {
8B 02 00 54 14 01 00 B5
?? ?? ?? ??
01 98 81 52 E2 0F 80 52 00
?? ?? ?? ??
??
D6 97 F4 03 00 AA C0 01 00 B4 E0 03 14 AA E1 03 15 AA
??
?? E9 97
C8 06 00 51 89 4A 68 38 3F 29 00 71 41 00 00 54 9F 6A 28 38 E0 03 1F 2A 74 02 00 F9 04 00 00 14 A0 02 80 12
}
condition:
$fix and console.log("CVE-2024-42236 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/CVE-2024-42236/TestcaseRule-CVE-2024-42236.yara
|
YARA
|
unknown
| 1,305
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule CVE_2024_42115
{
meta:
date="2024-10"
openharmony_sa=""
cve="CVE_2024_42115"
affected_files="/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {60 C2 01 91 ?? ?? F8 97}
$fix = {60 C2 01 91 7F 2E 00 F9 ?? ?? F8 97}
condition:
((not $vul) or $fix) and console.log("CVE-2024-42115 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/CVE_2024_42115/TestCaseRule-CVE-2024-42115.yara
|
YARA
|
unknown
| 1,087
|
/*
*Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*http://www.apache.org/licenses/LICENSE-2.0
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_42114
{
meta:
date = "2024-09-26"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$vul = {A8 82 23 91 F3 03 00 AA 08 FD DF C8 16 01 40 F9 C8 52 41 39}
$fix = {D6 C2 00 91 F3 03 00 AA E0 03 16 AA 0F 40 51 94 A8 82 23 91 09 41 38 D5 08 FD DF C8 E1 03 13 AA}
condition:
((not $vul) or $fix) and console.log("OpenHarmony-CVE-2024-42114 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/10/OpenHarmony-CVE-2024-42114/TestCaseRule-OpenHarmony-CVE-2024-42114.yara
|
YARA
|
unknown
| 1,113
|
/*
* Copyright (c) 2024 Beijing University of Posts and Telecommunications.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import "console"
rule TestCaseRule_OpenHarmony_CVE_2024_26684
{
meta:
date = "2024-02-19"
file = "/dev/block/platform/fe310000.sdhci/by-name/boot_linux"
strings:
$fix = "Read Rx Descriptor Parity checker Error"
condition:
$fix and console.log("OpenHarmony-CVE-2024-26684 testcase pass")
}
|
2301_80000730/security_1308
|
vulntest/SSTSTestcases/2024/12/CVE-2024-26684/TestCaseRule-OpenHarmony-CVE-2024-26684.yara
|
YARA
|
unknown
| 1,016
|
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
|
2301_80000730/security_1308
|
vulntest/vultraining/entry/hvigorfile.ts
|
TypeScript
|
unknown
| 234
|
import { appTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
|
2301_80000730/security_1308
|
vulntest/vultraining/hvigorfile.ts
|
TypeScript
|
unknown
| 234
|
#include <bits/stdc++>
using namespace
int main()
{
cout << "hello, github " <<endl;
return 0;
}
|
2301_80043048/psycho0816
|
main.cpp
|
C++
|
unknown
| 112
|
# 使用官方的 Java 17-jdk-slim 作为基础镜像
FROM openjdk:17-jdk-slim
# 设置工作目录
WORKDIR /app
# 将构建好的 JAR 文件复制到容器中
COPY target/comment-service-0.0.1-SNAPSHOT.jar app.jar
# 暴露端口
EXPOSE 8088
# 运行应用程序
ENTRYPOINT ["java", "-jar", "app.jar"]
|
2301_79970562/student_union_backend
|
comment-service/Dockerfile
|
Dockerfile
|
unknown
| 306
|
package org.commentservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CommentServiceApplication {
public static void main(String[] args) {
SpringApplication.run(CommentServiceApplication.class, args);
}
}
|
2301_79970562/student_union_backend
|
comment-service/src/main/java/org/commentservice/CommentServiceApplication.java
|
Java
|
unknown
| 339
|
package org.commentservice.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.commentservice.entity.Comment;
import org.commentservice.service.CommentService;
import org.commentservice.utils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.List;
@CrossOrigin
@Tag(name = "评论管理",description = "评论管理相关接口")
@RestController
@RequestMapping("/comment")
public class CommentController {
@Autowired
private CommentService commentService;
@Operation(summary = "添加评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "添加成功"),
@ApiResponse(responseCode = "400", description = "已评论过"),
@ApiResponse(responseCode = "500", description = "添加失败")
})
@PostMapping({"/add"})//http://localhost:8089/main/comment/add
public CommonResult addComment(@RequestBody Comment comment) {
CommonResult commonResult = new CommonResult();
try {
Comment exComment = commentService.findByHouseIdAndTenantId(comment.getHouseId(), comment.getTenantId());
if (exComment != null) {
commonResult.setCode(400);
commonResult.setMsg("已评论过");
} else {
commentService.add(comment);
commonResult.setCode(200);
commonResult.setMsg("添加成功");
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("添加失败");
}
return commonResult;
}
@Operation(summary = "删除评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "删除成功"),
@ApiResponse(responseCode = "500", description = "删除失败")
})
@DeleteMapping("/delete/{commentId}")//http://localhost:8089/main/comment/delete/{commentId}
public CommonResult delete(@PathVariable long commentId) {
CommonResult commonResult = new CommonResult();
try{
commentService.deleteById(commentId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("删除成功");
}
return commonResult;
}
@Operation(summary = "修改评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "修改成功"),
@ApiResponse(responseCode = "500", description = "修改失败")
})
@PutMapping("/update")//http://localhost:8089/main/comment/update
public CommonResult update(@RequestBody Comment comment) {
CommonResult commonResult = new CommonResult();
try{
Timestamp commentTime = Timestamp.from(Instant.now());
comment.setCommentTime(commentTime);
commentService.update(comment);
commonResult.setCode(200);
commonResult.setMsg("修改成功");
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("修改成功");
}
return commonResult;
}
@Operation(summary = "查询指定房源的所有评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/house/{houseId}")//http://localhost:8089/main/comment/house/{houseId}
public CommonResult getByHouse(@PathVariable long houseId) {
CommonResult commonResult = new CommonResult();
try{
List<Comment> comments = commentService.findByHouseId(houseId);
if (!comments.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(comments);
}
else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "查询某租户发表的所有评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/tenant/{tenantId}")//http://localhost:8089/main/comment/tenant/{tenantId}
public CommonResult getByTenant(@PathVariable long tenantId) {
CommonResult commonResult = new CommonResult();
try{
List<Comment> comments = commentService.findByTenantId(tenantId);
if (!comments.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(comments);
}
else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询错误")
})
@GetMapping("/findAll")//http://localhost:8089/main/comment/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<Comment> comments = commentService.findAll();
if (!comments.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(comments);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
comment-service/src/main/java/org/commentservice/controller/CommentController.java
|
Java
|
unknown
| 6,743
|
package org.commentservice.dao;
import org.apache.ibatis.annotations.Mapper;
import org.commentservice.entity.Comment;
import java.util.List;
@Mapper
public interface CommentMapper {
int insert(Comment comment);//添加评论
int deleteById(long commentId); //删除评论
int update(Comment comment);//修改评论
List<Comment> findByHouseId(long houseId);//查询指定房源的所有评论
List<Comment> findByTenantId(long tenantId);//查询某租户发表的所有评论
Comment findByHouseIdAndTenantId(long houseId, long tenantId);
List<Comment> findAll();
}
|
2301_79970562/student_union_backend
|
comment-service/src/main/java/org/commentservice/dao/CommentMapper.java
|
Java
|
unknown
| 600
|
package org.commentservice.entity;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Comment",description = "评论实体")
public class Comment {
@Schema(name = "commentId",description = "评论id")
private long commentId;
@Schema(name = "houseId",description = "房源id")
private long houseId;
@Schema(name = "tenantId",description = "租客id")
private long tenantId;
@Schema(name = "content",description = "内容")
private String content;
@Schema(name = "rating",description = "评分")
private long rating;
@Schema(name = "commentTime",description = "评论时间")
private java.sql.Timestamp commentTime;
public long getCommentId() {
return commentId;
}
public void setCommentId(long commentId) {
this.commentId = commentId;
}
public long getHouseId() {
return houseId;
}
public void setHouseId(long houseId) {
this.houseId = houseId;
}
public long getTenantId() {
return tenantId;
}
public void setTenantId(long tenantId) {
this.tenantId = tenantId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public long getRating() {
return rating;
}
public void setRating(long rating) {
this.rating = rating;
}
public java.sql.Timestamp getCommentTime() {
return commentTime;
}
public void setCommentTime(java.sql.Timestamp commentTime) {
this.commentTime = commentTime;
}
}
|
2301_79970562/student_union_backend
|
comment-service/src/main/java/org/commentservice/entity/Comment.java
|
Java
|
unknown
| 1,507
|
package org.commentservice.service;
import org.commentservice.entity.Comment;
import java.util.List;
public interface CommentService {
int add(Comment comment);
int deleteById(long commentId);
int update(Comment comment);
List<Comment> findByHouseId(long houseId);
List<Comment> findByTenantId(long tenantId);
Comment findByHouseIdAndTenantId(long houseId, long tenantId);
List<Comment> findAll();
}
|
2301_79970562/student_union_backend
|
comment-service/src/main/java/org/commentservice/service/CommentService.java
|
Java
|
unknown
| 432
|
package org.commentservice.service.impl;
import org.apache.log4j.Logger;
import org.commentservice.dao.CommentMapper;
import org.commentservice.entity.Comment;
import org.commentservice.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CommentServiceImpl implements CommentService {
private static final Logger logger = Logger.getLogger(CommentServiceImpl.class);
@Autowired
private CommentMapper commentMapper;
@Override
public int add(Comment comment){
logger.info("Adding new comment for house ID: " + comment.getHouseId() + " by tenant ID: " + comment.getTenantId());
int result = commentMapper.insert(comment);
logger.info("Comment added with ID: " + comment.getCommentId() + ", result: " + result);
return result;
}
@Override
public int deleteById(long commentId){
logger.info("Deleting comment by ID: " + commentId);
int result = commentMapper.deleteById(commentId);
logger.info("Comment deletion result: " + result);
return result;
}
@Override
public int update(Comment comment){
logger.info("Updating comment with ID: " + comment.getCommentId());
int result = commentMapper.update(comment);
logger.info("Comment update result: " + result);
return result;
}
@Override
public List<Comment> findByHouseId(long houseId){
logger.info("Finding comments by house ID: " + houseId);
List<Comment> comments = commentMapper.findByHouseId(houseId);
logger.debug("Found " + comments.size() + " comments for house ID: " + houseId);
return comments;
}
@Override
public List<Comment> findByTenantId(long tenantId){
logger.info("Finding comments by tenant ID: " + tenantId);
List<Comment> comments = commentMapper.findByTenantId(tenantId);
logger.debug("Found " + comments.size() + " comments for tenant ID: " + tenantId);
return comments;
}
@Override
public Comment findByHouseIdAndTenantId(long houseId, long tenantId){
logger.info("Finding comment by house ID: " + houseId + " and tenant ID: " + tenantId);
Comment comment = commentMapper.findByHouseIdAndTenantId(houseId, tenantId);
logger.debug("Found comment: " + comment);
return comment;
}
@Override
public List<Comment> findAll(){
logger.info("Retrieving all comments");
List<Comment> comments = commentMapper.findAll();
logger.debug("Found " + comments.size() + " comments");
return comments;
}
}
|
2301_79970562/student_union_backend
|
comment-service/src/main/java/org/commentservice/service/impl/CommentServiceImpl.java
|
Java
|
unknown
| 2,710
|
package org.commentservice.utils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "通用响应结果",name = "CommonResult")
public class CommonResult {
@Schema(name = "code",description = "响应状态码")
private int code; //响应状态码
@Schema(name = "msg",description = "响应信息")
private String msg; //响应信息
@Schema(name = "data",description = "响应数据")
private Object data;
public CommonResult() {}
public CommonResult(Integer code, String msg, Object data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
|
2301_79970562/student_union_backend
|
comment-service/src/main/java/org/commentservice/utils/CommonResult.java
|
Java
|
unknown
| 1,039
|
package org.example.main;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@SpringBootApplication
@EnableAspectJAutoProxy
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/MainApplication.java
|
Java
|
unknown
| 411
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.utils.CommonResult;
import org.example.main.entity.Admin;
import org.example.main.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.example.main.utils.KeyUtils;
import org.example.main.utils.Sm2Util;
@CrossOrigin
@Tag(name = "管理员管理",description = "管理员管理相关接口")
@RestController
@RequestMapping("/admin")
public class AdminController {
private static final Logger logger = Logger.getLogger(AdminController.class);
@Autowired
private AdminService adminService;
@Operation(summary = "管理员注册")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "注册成功"),
@ApiResponse(responseCode = "400", description = "用户名已存在"),
@ApiResponse(responseCode = "500", description = "注册失败")
})
@PostMapping("/register")//http://localhost:8089/main/admin/register
public CommonResult register(@RequestBody Admin admin) {
CommonResult commonResult = new CommonResult();
try {
Admin existing = adminService.findByUsername(admin.getUsername());
if (existing != null) {
commonResult.setCode(400);
commonResult.setMsg("用户名已存在");
}
else {
// 生成SM2密钥对
Map<String, String> keyPair = KeyUtils.generateSmKey();
String publicKeyStr = keyPair.get(KeyUtils.PUBLIC_KEY);
String privateKeyStr = keyPair.get(KeyUtils.PRIVATE_KEY);
// 保存公钥和私钥
admin.setPublicKey(publicKeyStr);
admin.setPrivateKey(privateKeyStr);
adminService.add(admin);
commonResult.setCode(200);
commonResult.setMsg("注册成功");
Admin current = adminService.findByUsername(admin.getUsername());
commonResult.setData(current);
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("注册失败");
}
return commonResult;
}
@Operation(summary = "管理员登录")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "登录成功"),
@ApiResponse(responseCode = "401", description = "用户名或密码错误"),
@ApiResponse(responseCode = "500", description = "登录失败")
})
@PostMapping("/login")//http://localhost:8089/main/admin/login
public CommonResult login(@RequestBody Admin admin) {
CommonResult commonResult = new CommonResult();
// try{
// Admin real = adminService.findByUsername(admin.getUsername());
// if (real == null || !real.getPassword().equals(admin.getPassword())) {
// commonResult.setCode(401);
// commonResult.setMsg("用户名或密码错误");
// } else {
// commonResult.setCode(200);
// commonResult.setMsg("登录成功");
// commonResult.setData(real);
// }
// }catch (Exception e) {
// commonResult.setCode(500);
// commonResult.setMsg("登陆失败");
// }
try {
Admin real = adminService.findByUsername(admin.getUsername());
if (real == null) {
commonResult.setCode(401);
commonResult.setMsg("用户名或密码错误");
return commonResult;
}
// 获取用户的公钥和私钥
String publicKeyStr = real.getPublicKey();
String privateKeyStr = real.getPrivateKey();
if (publicKeyStr == null || privateKeyStr == null) {
logger.warn("用户未设置SM2密钥对: " + admin.getUsername());
commonResult.setCode(500);
commonResult.setMsg("用户密钥信息不完整");
return commonResult;
}
// 将Base64字符串转换为公钥和私钥对象
PublicKey publicKey = KeyUtils.createPublicKey(publicKeyStr);
PrivateKey privateKey = KeyUtils.createPrivateKey(privateKeyStr);
if (publicKey == null || privateKey == null) {
logger.error("密钥转换失败: " + admin.getUsername());
commonResult.setCode(500);
commonResult.setMsg("密钥解析失败");
return commonResult;
}
// 使用SM2公钥加密用户提交的密码
byte[] encryptedPasswordBytes = Sm2Util.encrypt(
admin.getPassword().getBytes(), publicKey);
if (encryptedPasswordBytes == null) {
logger.error("SM2加密失败: " + admin.getUsername());
commonResult.setCode(500);
commonResult.setMsg("密码加密失败");
return commonResult;
}
// 使用SM2私钥解密得到原始密码
byte[] decryptedPasswordBytes = Sm2Util.decrypt(
encryptedPasswordBytes, privateKey);
if (decryptedPasswordBytes == null) {
logger.error("SM2解密失败: " + admin.getUsername());
commonResult.setCode(500);
commonResult.setMsg("密码解密失败");
return commonResult;
}
// 将解密后的密码与数据库中的密码进行比较
String decryptedPassword = new String(decryptedPasswordBytes);
if (decryptedPassword.equals(real.getPassword())) {
commonResult.setCode(200);
commonResult.setMsg("登录成功");
commonResult.setData(real);
} else {
commonResult.setCode(401);
commonResult.setMsg("用户名或密码错误");
}
} catch (Exception e) {
logger.error("管理员登录失败", e);
commonResult.setCode(500);
commonResult.setMsg("登录失败");
}
return commonResult;
}
@Operation(summary = "修改管理员记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "修改成功"),
@ApiResponse(responseCode = "500",description = "修改失败")
})
//修改数据
@PutMapping("/updateById")//http://localhost:8089/main/damin/updateById
public CommonResult updateById(@RequestBody Admin admin) {
CommonResult commonResult = new CommonResult();
try {
adminService.updateById(admin);
commonResult.setCode(200);
commonResult.setMsg("修改成功");
}
catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("修改失败"+e.getMessage());
}
return commonResult;
}
@Operation(summary = "删除管理员记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "删除成功"),
@ApiResponse(responseCode = "500",description = "删除失败")
})
@DeleteMapping("/delete/{adminId}")//http://localhost:8089/main/admin/delete/{adminId}
public CommonResult deleteById(@PathVariable long adminId) {
CommonResult commonResult = new CommonResult();
try{
adminService.deleteById(adminId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("删除失败");
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询错误")
})
@GetMapping("/findAll")//http://localhost:8089/main/admin/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<Admin> admins = adminService.findAll();
if(admins == null){
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}else {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(admins);
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "按id查询")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "查询成功"),
@ApiResponse(responseCode = "500",description = "查询失败"),
@ApiResponse(responseCode = "404",description = "未查询到")
})
@GetMapping("/findById/{adminId}")//http://localhost:8089/main/admin/findById/{adminId}
public CommonResult findById(@PathVariable long adminId) {
CommonResult commonResult = new CommonResult();
try{
Admin admin=adminService.findById(adminId);
if(admin!=null){
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(admin);
}
else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/AdminController.java
|
Java
|
unknown
| 10,211
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.entity.Admin;
import org.example.main.entity.Comment;
import org.example.main.entity.Favorite;
import org.example.main.entity.House;
import org.example.main.service.CommentService;
import org.example.main.utils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.ArrayList;
import java.sql.Timestamp;
import java.time.Instant;
@CrossOrigin
@Tag(name = "评论管理",description = "评论管理相关接口")
@RestController
@RequestMapping("/comment")
public class CommentController {
@Autowired
private CommentService commentService;
@Operation(summary = "添加评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "添加成功"),
@ApiResponse(responseCode = "400", description = "已评论过"),
@ApiResponse(responseCode = "500", description = "添加失败")
})
@PostMapping({"/add"})//http://localhost:8089/main/comment/add
public CommonResult addComment(@RequestBody Comment comment) {
CommonResult commonResult = new CommonResult();
try {
Comment exComment = commentService.findByHouseIdAndTenantId(comment.getHouseId(), comment.getTenantId());
if (exComment != null) {
commonResult.setCode(400);
commonResult.setMsg("已评论过");
} else {
commentService.add(comment);
commonResult.setCode(200);
commonResult.setMsg("添加成功");
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("添加失败");
}
return commonResult;
}
@Operation(summary = "删除评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "删除成功"),
@ApiResponse(responseCode = "500", description = "删除失败")
})
@DeleteMapping("/delete/{commentId}")//http://localhost:8089/main/comment/delete/{commentId}
public CommonResult delete(@PathVariable long commentId) {
CommonResult commonResult = new CommonResult();
try{
commentService.deleteById(commentId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("删除成功");
}
return commonResult;
}
@Operation(summary = "修改评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "修改成功"),
@ApiResponse(responseCode = "500", description = "修改失败")
})
@PutMapping("/update")//http://localhost:8089/main/comment/update
public CommonResult update(@RequestBody Comment comment) {
CommonResult commonResult = new CommonResult();
try{
Timestamp commentTime = Timestamp.from(Instant.now());
comment.setCommentTime(commentTime);
commentService.update(comment);
commonResult.setCode(200);
commonResult.setMsg("修改成功");
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("修改成功");
}
return commonResult;
}
@Operation(summary = "查询指定房源的所有评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/house/{houseId}")//http://localhost:8089/main/comment/house/{houseId}
public CommonResult getByHouse(@PathVariable long houseId) {
CommonResult commonResult = new CommonResult();
try{
List<Comment> comments = commentService.findByHouseId(houseId);
if (!comments.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(comments);
}
else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "查询某租户发表的所有评论")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/tenant/{tenantId}")//http://localhost:8089/main/comment/tenant/{tenantId}
public CommonResult getByTenant(@PathVariable long tenantId) {
CommonResult commonResult = new CommonResult();
try{
List<Comment> comments = commentService.findByTenantId(tenantId);
if (!comments.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(comments);
}
else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询错误")
})
@GetMapping("/findAll")//http://localhost:8089/main/comment/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<Comment> comments = commentService.findAll();
if (!comments.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(comments);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/CommentController.java
|
Java
|
unknown
| 6,880
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.entity.Admin;
import org.example.main.utils.CommonResult;
import org.example.main.entity.Favorite;
import org.example.main.service.FavoriteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@CrossOrigin
@Tag(name = "收藏管理",description = "收藏管理相关接口")
@RestController
@RequestMapping("/favorite")
public class FavoriteController {
@Autowired
private FavoriteService favoriteService;
@Operation(summary = "添加收藏")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "添加成功"),
@ApiResponse(responseCode = "500", description = "添加失败"),
@ApiResponse(responseCode = "400", description = "已收藏"),
})
@PostMapping("/add")//http://localhost:8089/main/favorite/add
public CommonResult add(@RequestBody Favorite favorite) {
CommonResult commonResult = new CommonResult();
try {
Favorite existing = favoriteService.getByTenantAndHouse(favorite.getTenantId(), favorite.getHouseId());
if (existing != null) {
commonResult.setCode(400);
commonResult.setMsg("已收藏");
} else {
favorite.setFavoriteTime(new Date());
favoriteService.add(favorite);
commonResult.setCode(200);
commonResult.setMsg("收藏成功");
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("收藏失败");
}
return commonResult;
}
@Operation(summary = "取消收藏")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "取消成功"),
@ApiResponse(responseCode = "500", description = "取消失败")
})
@DeleteMapping("/cancel")//http://localhost:8089/main/favorite/cancel
public CommonResult cancel(@RequestBody Favorite favorite) {
CommonResult commonResult = new CommonResult();
try{
long tenantId = favorite.getTenantId();
long houseId = favorite.getHouseId();
favoriteService.removeByTenantAndHouse(tenantId, houseId);
commonResult.setCode(200);
commonResult.setMsg("取消成功");
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("取消失败");
}
return commonResult;
}
@Operation(summary = "根据租客ID查询收藏")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/tenant/{tenantId}")//http://localhost:8089/main/favorite/tenant/{tenantId}
public CommonResult getByTenant(@PathVariable long tenantId) {
CommonResult commonResult = new CommonResult();
try{
List<Favorite> list = favoriteService.getByTenantId(tenantId);
if(!list.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据房源ID查询收藏")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/house/{houseId}")//http://localhost:8089/main/favorite/house/{houseId}
public CommonResult getByHouse(@PathVariable long houseId) {
CommonResult commonResult = new CommonResult();
try{
List<Favorite> list = favoriteService.getByHouseId(houseId);
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/findAll")//http://localhost:8089/main/favorite/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<Favorite> favorites = favoriteService.findAll();
if(!favorites.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(favorites);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据租客&房源查询收藏")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@PostMapping("/tenantAndHouse")//http://localhost:8089/main/favorite/tenantAndHouse
public CommonResult getByTenantAndHouse(@RequestBody Favorite favorite) {
CommonResult commonResult = new CommonResult();
try{
Favorite existing = favoriteService.getByTenantAndHouse(favorite.getTenantId(), favorite.getHouseId());
if (existing != null) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(true);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
commonResult.setData(false);
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/FavoriteController.java
|
Java
|
unknown
| 6,925
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.utils.CommonResult;
import org.example.main.entity.House;
import org.example.main.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@CrossOrigin
@Tag(name = "房源管理", description = "房源管理操作接口")
@RestController
@RequestMapping("/house")
public class HouseController {
@Autowired
private HouseService houseService;
@Operation(summary = "房东提交申请")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "申请发送成功"),
@ApiResponse(responseCode = "500", description = "申请发送失败")
})
@PostMapping("/add")//http://localhost:8089/main/house/add
public CommonResult add(@RequestBody House house) {
house.setStatus("pending"); // 初始状态为审核中
CommonResult commonResult = new CommonResult();
try{
houseService.add(house);
commonResult.setCode(200);
commonResult.setMsg("申请发送成功");
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("申请发送失败");
}
return commonResult;
}
@Operation(summary = "房东修改房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "修改成功"),
@ApiResponse(responseCode = "500", description = "修改失败")
})
@PutMapping("/update")//http://localhost:8089/main/house/update
public CommonResult update(@RequestBody House house) {
CommonResult commonResult = new CommonResult();
try {
houseService.update(house);
commonResult.setCode(200);
commonResult.setMsg("修改成功");
}
catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("修改失败");
}
return commonResult;
}
@Operation(summary = "删除房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "删除成功"),
@ApiResponse(responseCode = "500", description = "删除失败")
})
@DeleteMapping("/delete/{houseId}")//http://localhost:8089/main/house/delete/{houseId}
public CommonResult delete(@PathVariable long houseId) {
CommonResult commonResult = new CommonResult();
try {
houseService.deleteById(houseId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}
catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("删除失败");
}
return commonResult;
}
@Operation(summary = "查询所有房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/findAll")//http://localhost:8089/main/house/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<House> list = houseService.findAll();
if(!list.isEmpty()){
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据房东ID查询房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/landlord/{landlordId}")//http://localhost:8089/main/house/landlord/{landlordId}
public CommonResult getByLandlord(@PathVariable long landlordId) {
CommonResult commonResult = new CommonResult();
try{
List<House> list = houseService.findByLandlordId(landlordId);
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据状态查询房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/status")//http://localhost:8089/main/house/status
public CommonResult getByStatus(@RequestParam String status) {
CommonResult commonResult = new CommonResult();
try{
List<House> list = houseService.findByStatus(status);
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据房屋ID查找房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/{houseId}")//http://localhost:8089/main/house/{houseId}
public CommonResult getById(@PathVariable long houseId) {
CommonResult commonResult = new CommonResult();
try{
House house = houseService.findById(houseId);
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(house);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "更新房源状态")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "更新成功"),
@ApiResponse(responseCode = "500", description = "更新失败")
})
@PutMapping("/statu")//http://localhost:8089/main/house/statu
public CommonResult updateStatus(@RequestParam long houseId, @RequestParam String status) {
CommonResult commonResult = new CommonResult();
try {
houseService.updateStatus(houseId, status);
commonResult.setCode(200);
commonResult.setMsg("更新成功");
}
catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("更新失败");
}
return commonResult;
}
@Operation(summary = "根据名称查询房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/title/{title}")//http://localhost:8089/main/house/title/{title}
public CommonResult findByTitle(@PathVariable String title) {
CommonResult commonResult = new CommonResult();
try{
List<House> list = houseService.findByTitle(title);
if(!list.isEmpty()){
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据地区查询房源")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/area/{area}")//http://localhost:8089/main/house/area/{area}
public CommonResult findByArea(@PathVariable String area) {
CommonResult commonResult = new CommonResult();
try{
List<House> list = houseService.findByArea(area);
if(!list.isEmpty()){
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/HouseController.java
|
Java
|
unknown
| 9,381
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.entity.Admin;
import org.example.main.entity.Tenant;
import org.example.main.utils.CommonResult;
import org.example.main.entity.Landlord;
import org.example.main.service.LandlordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@CrossOrigin
@Tag(name = "房东管理",description = "房东管理相关接口")
@RestController
@RequestMapping("/landlord")
public class LandlordController {
@Autowired
private LandlordService landlordService;
@Operation(summary = "房东注册")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "注册成功"),
@ApiResponse(responseCode = "400", description = "用户名已存在"),
@ApiResponse(responseCode = "500", description = "注册失败")
})
@PostMapping("/register")//http://localhost:8089/main/landlord/register
public CommonResult register(@RequestBody Landlord landlord) {
CommonResult commonResult = new CommonResult();
try{
Landlord existing = landlordService.findByUsername(landlord.getUsername());
if (existing != null) {
commonResult.setCode(400);
commonResult.setMsg("用户名已存在");
}else{
landlordService.add(landlord);
commonResult.setCode(200);
commonResult.setMsg("注册成功");
Landlord current = landlordService.findByUsername(landlord.getUsername());
commonResult.setData(current);
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("注册失败");
}
return commonResult;
}
@Operation(summary = "房东登录")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "登录成功"),
@ApiResponse(responseCode = "401", description = "用户名或密码错误")
})
@PostMapping("/login")//http://localhost:8089/main/landlord/login
public CommonResult login(@RequestBody Landlord landlord) {
CommonResult commonResult = new CommonResult();
try{
Landlord real = landlordService.findByUsername(landlord.getUsername());
if (real == null || !real.getPassword().equals(landlord.getPassword())) {
commonResult.setCode(401);
commonResult.setMsg("用户名或密码错误");
} else {
commonResult.setCode(200);
commonResult.setMsg("登录成功");
commonResult.setData(real);
}
}catch(Exception e){
commonResult.setCode(500);
commonResult.setMsg("登陆失败");
}
return commonResult;
}
@Operation(summary = "删除房东记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "删除成功"),
@ApiResponse(responseCode = "500",description = "删除失败")
})
@DeleteMapping("/delete/{landlordId}")//http://localhost:8089/main/landlord/delete/{adminId}
public CommonResult deleteById(@PathVariable long landlordId) {
CommonResult commonResult = new CommonResult();
try{
landlordService.deleteById(landlordId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("删除失败");
}
return commonResult;
}
@Operation(summary = "修改房东记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "修改成功"),
@ApiResponse(responseCode = "500",description = "修改失败")
})
//修改数据
@PutMapping("/updateById")//http://localhost:8089/main/landlord/updateById
public CommonResult updateById(@RequestBody Landlord landlord) {
CommonResult commonResult = new CommonResult();
try {
landlordService.updateById(landlord);
commonResult.setCode(200);
commonResult.setMsg("修改成功");
}
catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("修改失败"+e.getMessage());
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询错误")
})
@GetMapping("/findAll")//http://localhost:8089/main/landlord/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<Landlord> landlords = landlordService.findAll();
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(landlords);
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "按id查询")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "查询成功"),
@ApiResponse(responseCode = "500",description = "查询失败"),
@ApiResponse(responseCode = "404",description = "未查询到")
})
@GetMapping("/findById/{landlordId}")//http://localhost:8089/main/landlord/findById/{landlordId}
public CommonResult findById(@PathVariable long landlordId) {
CommonResult commonResult = new CommonResult();
try{
Landlord landlord=landlordService.findById(landlordId);
if(landlord!=null){
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(landlord);
}
else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/LandlordController.java
|
Java
|
unknown
| 6,529
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.entity.House;
import org.example.main.entity.Record;
import org.example.main.service.HouseService;
import org.example.main.service.RecordService;
import org.example.main.utils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@CrossOrigin
@Tag(name = "历史记录管理",description = "历史记录管理相关接口")
@RestController
@RequestMapping("/record")
public class RecordController {
@Autowired
private RecordService recordService;
@Autowired
private HouseService houseService;
@Operation(summary = "增加历史记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "增加成功"),
@ApiResponse(responseCode = "500",description = "增加失败")
})
@PostMapping("add")//http://localhost:8089/main/record/add
public CommonResult add(@RequestBody Record record) {
CommonResult commonResult = new CommonResult();
try{
recordService.add(record);
commonResult.setCode(200);
commonResult.setMsg("增加成功");
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg(e.getMessage());
}
return commonResult;
}
@Operation(summary = "删除历史记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "删除成功"),
@ApiResponse(responseCode = "500",description = "删除失败")
})
@DeleteMapping("/delete/{recordId}")//http://localhost:8089/main/record/delete/{recordId}
public CommonResult deleteById(@PathVariable long recordId) {
CommonResult commonResult = new CommonResult();
try{
recordService.deleteById(recordId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("删除失败");
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询错误")
})
@GetMapping("/findAll")//http://localhost:8089/main/record/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<Record> records = recordService.findAll();
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(records);
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据房源ID查询历史记录")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/house/{houseId}")//http://localhost:8089/main/record/house/{houseId}
public CommonResult getByHouse(@PathVariable long houseId) {
CommonResult commonResult = new CommonResult();
try{
List<Record> list = recordService.findByHouseId(houseId);
if (!list.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据房东ID查询历史记录")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/landlord/{landlordId}")//http://localhost:8089/main/record/landlord/{landlordId}
public CommonResult getByLandlord(@PathVariable long landlordId) {
CommonResult commonResult = new CommonResult();
try{
List<House> houseList = houseService.findByLandlordId(landlordId);
List<Record> list = new ArrayList<>();
for (House house : houseList) {
long currentHouseId = house.getHouseId();
List<Record> currentHouseRecords = recordService.findByHouseId(currentHouseId);
list.addAll(currentHouseRecords);
}
if (!list.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据租客ID查询历史记录")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "404", description = "未查询到"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/tenant/{tenantId}")//http://localhost:8089/main/record/tenant/{tenantId}
public CommonResult getByTenant(@PathVariable long tenantId) {
CommonResult commonResult = new CommonResult();
try{
List<Record> list = recordService.findByTenantId(tenantId);
if (!list.isEmpty()) {
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/RecordController.java
|
Java
|
unknown
| 6,726
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.entity.House;
import org.example.main.utils.CommonResult;
import org.example.main.entity.RentalApplication;
import org.example.main.service.HouseService;
import org.example.main.service.RecordService;
import org.example.main.entity.Record;
import org.example.main.service.RentalApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@CrossOrigin
@Tag(name = "租聘审核管理",description = "租聘申请管理相关接口")
@RestController
@RequestMapping("/rental")
public class RentalApplicationController {
@Autowired
private RentalApplicationService rentalApplicationService;
@Autowired
private HouseService houseService;
@Autowired
private RecordService recordService;
@Operation(summary = "租客申请租/退房")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "申请成功"),
@ApiResponse(responseCode = "400", description = "已申请"),
@ApiResponse(responseCode = "404", description = "未申请租房"),
@ApiResponse(responseCode = "500", description = "申请失败")
})
@PostMapping("/apply")//http://localhost:8089/main/rental/apply
public CommonResult applyIn(@RequestBody RentalApplication application) {
CommonResult commonResult = new CommonResult();
try{
long tenantId = application.getTenantId();
long houseId = application.getHouseId();
String type = application.getType();
if(type.equals("in")){
RentalApplication rentalApplication = rentalApplicationService.findByTenantIdAndHouseIdAndType(tenantId, houseId, "in");
if(rentalApplication == null){
rentalApplicationService.apply(application);
commonResult.setCode(200);
commonResult.setMsg(("申请成功"));
}
else{
commonResult.setCode(400);
commonResult.setMsg("请勿重复申请");
}
}
else if(type.equals("out")){
RentalApplication ex = rentalApplicationService.findByTenantIdAndHouseIdAndType(tenantId, houseId, "out");
RentalApplication rentalApplication = rentalApplicationService.findByTenantIdAndHouseIdAndType(tenantId, houseId, "in");
if(ex != null){
commonResult.setCode(400);
commonResult.setMsg("请勿重复申请");
}else if(rentalApplication != null && rentalApplication.getStatus().equals("approved")){
long id = rentalApplication.getApplicationId();
rentalApplicationService.delete(id);
rentalApplicationService.apply(application);
commonResult.setCode(200);
commonResult.setMsg("申请成功");
}
else{
commonResult.setCode(404);
commonResult.setMsg("未申请租房");
}
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("申请失败");
}
return commonResult;
}
@Operation(summary = "审核申请")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "审核成功"),
@ApiResponse(responseCode = "500", description = "审核失败")
})
@PutMapping("/judge")//http://localhost:8089/main/rental/judge
public CommonResult approve(@RequestParam long rentalApplicationId, @RequestParam String status) {
CommonResult commonResult = new CommonResult();
try{
RentalApplication rentalApplication = rentalApplicationService.findById(rentalApplicationId);
String type = rentalApplication.getType();
long houseId = rentalApplication.getHouseId();
if(type.equals("in")){
rentalApplicationService.updateStatus(rentalApplicationId,status);
if(status.equals("approved")){
houseService.updateStatus(houseId, "rented");
commonResult.setCode(200);
commonResult.setMsg("已通过");
}
else if(status.equals("rejected")){
houseService.updateStatus(houseId, "available");
commonResult.setCode(201);
commonResult.setMsg("已拒绝");
}
}else{
rentalApplicationService.updateStatus(rentalApplicationId,status);
if(status.equals("approved")){
houseService.updateStatus(houseId, "available");
Record record = new Record();
long tenantId = rentalApplication.getTenantId();
record.setHouseId(houseId);
record.setTenantId(tenantId);
recordService.add(record);
rentalApplicationService.delete(rentalApplicationId);
commonResult.setCode(200);
commonResult.setMsg("已通过");
}
else if(status.equals("rejected")){
houseService.updateStatus(houseId, "pending");
commonResult.setCode(201);
commonResult.setMsg("已拒绝");
}
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("审核失败");
}
return commonResult;
}
@Operation(summary = "根据租客ID查询")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/tenant/{tenantId}")//http://localhost:8089/main/rental/tenant/{tenantId}
public CommonResult getByTenant(@PathVariable long tenantId) {
CommonResult commonResult = new CommonResult();
try{
List<RentalApplication> list = rentalApplicationService.findByTenantId(tenantId);
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据房源ID查询")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/house/{houseId}")//http://localhost:8089/main/rental/house/{houseId}
public CommonResult getByHouse(@PathVariable long houseId) {
CommonResult commonResult = new CommonResult();
try{
List<RentalApplication> list = rentalApplicationService.findByHouseId(houseId);
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "根据房东ID查询")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/landlord/{landlordId}")//http://localhost:8089/main/rental/landlord/{landlordId}
public CommonResult getByLandlord(@PathVariable long landlordId) {
CommonResult commonResult = new CommonResult();
try{
List<House> houses = houseService.findByLandlordId(landlordId);
List<RentalApplication> list = new ArrayList<>();
for(House house : houses){
long id = house.getHouseId();
List<RentalApplication> current = rentalApplicationService.findByHouseId(id);
list.addAll(current);
}
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(list);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/findAll")//http://localhost:8089/main/rental/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<RentalApplication> rentalApplications = rentalApplicationService.findAll();
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(rentalApplications);
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "删除租房记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "删除成功"),
@ApiResponse(responseCode = "500",description = "删除失败")
})
@DeleteMapping("/delete/{rentalApplicationId}")//http://localhost:8089/main/rental/delete/{rentalApplicationId}
public CommonResult deleteById(@PathVariable long rentalApplicationId) {
CommonResult commonResult = new CommonResult();
try{
rentalApplicationService.delete(rentalApplicationId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("删除失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/RentalApplicationController.java
|
Java
|
unknown
| 10,464
|
package org.example.main.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.main.entity.Admin;
import org.example.main.entity.Landlord;
import org.example.main.utils.CommonResult;
import org.example.main.entity.Tenant;
import org.example.main.service.TenantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@CrossOrigin
@Tag(name = "租客管理",description = "租客管理相关接口")
@RestController
@RequestMapping("/tenant")
public class TenantController {
@Autowired
private TenantService tenantService;
@Operation(summary = "租客注册")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "注册成功"),
@ApiResponse(responseCode = "400", description = "用户名已存在"),
@ApiResponse(responseCode = "500", description = "注册失败"),
})
@PostMapping("/register")//http://localhost:8089/main/tenant/register
public CommonResult register(@RequestBody Tenant tenant) {
CommonResult commonResult = new CommonResult();
try{
Tenant existing = tenantService.findByUsername(tenant.getUsername());
if (existing != null) {
commonResult.setCode(400);
commonResult.setMsg("用户名已存在");
}else {
tenantService.add(tenant);
commonResult.setCode(200);
commonResult.setMsg("注册成功");
Tenant currentTenant = tenantService.findByUsername(tenant.getUsername());
commonResult.setData(currentTenant);
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("注册失败");
}
return commonResult;
}
@Operation(summary = "租客登录")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "登录成功"),
@ApiResponse(responseCode = "401", description = "用户名或密码错误"),
@ApiResponse(responseCode = "200", description = "登录失败")
})
@PostMapping("/login")//http://localhost:8089/main/tenant/login
public CommonResult login(@RequestBody Tenant tenant) {
CommonResult commonResult = new CommonResult();
try{
Tenant real = tenantService.findByUsername(tenant.getUsername());
if (real == null || !real.getPassword().equals(tenant.getPassword())) {
commonResult.setCode(401);
commonResult.setMsg("用户名或密码错误");
} else {
commonResult.setCode(200);
commonResult.setMsg("登录成功");
commonResult.setData(real);
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("登陆失败");
}
return commonResult;
}
@Operation(summary = "修改租客记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "修改成功"),
@ApiResponse(responseCode = "500",description = "修改失败")
})
//修改数据
@PutMapping("/updateById")//http://localhost:8089/main/tenant/updateById
public CommonResult updateById(@RequestBody Tenant tenant) {
CommonResult commonResult = new CommonResult();
try {
tenantService.updateById(tenant);
commonResult.setCode(200);
commonResult.setMsg("修改成功");
}
catch (Exception e) {
commonResult.setCode(500);
commonResult.setMsg("修改失败"+e.getMessage());
}
return commonResult;
}
@Operation(summary = "删除租客记录")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "删除成功"),
@ApiResponse(responseCode = "500",description = "删除失败")
})
@DeleteMapping("/delete/{tenantId}")//http://localhost:8089/main/tenant/delete/{tenantId}
public CommonResult deleteById(@PathVariable long tenantId) {
CommonResult commonResult = new CommonResult();
try{
tenantService.deleteById(tenantId);
commonResult.setCode(200);
commonResult.setMsg("删除成功");
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("删除失败");
}
return commonResult;
}
@Operation(summary = "查询所有")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "查询成功"),
@ApiResponse(responseCode = "500", description = "查询失败")
})
@GetMapping("/findAll")//http://localhost:8089/main/tenant/findAll
public CommonResult findAll() {
CommonResult commonResult = new CommonResult();
try{
List<Tenant> tenants = tenantService.findAll();
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(tenants);
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
@Operation(summary = "按id查询")
@ApiResponses({
@ApiResponse(responseCode = "200",description = "查询成功"),
@ApiResponse(responseCode = "500",description = "查询失败"),
@ApiResponse(responseCode = "404",description = "未查询到")
})
@GetMapping("/findById/{tenantId}")//http://localhost:8089/main/tenant/findById/{tenantId}
public CommonResult findById(@PathVariable long tenantId) {
CommonResult commonResult = new CommonResult();
try{
Tenant tenant=tenantService.findById(tenantId);
if(tenant!=null){
commonResult.setCode(200);
commonResult.setMsg("查询成功");
commonResult.setData(tenant);
}
else{
commonResult.setCode(404);
commonResult.setMsg("未查询到");
}
}catch (Exception e){
commonResult.setCode(500);
commonResult.setMsg("查询失败");
}
return commonResult;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/controller/TenantController.java
|
Java
|
unknown
| 6,527
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.Admin;
import java.util.List;
@Mapper
public interface AdminMapper {
Admin findByUsername(String username);
int insert(Admin admin);
int updateById(Admin admin);
int deleteById(long adminId);
Admin findById(long adminId);
List<Admin> findAll();
List<Admin> getUserByPage(int start, int size);
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/AdminMapper.java
|
Java
|
unknown
| 432
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.Comment;
import java.util.List;
@Mapper
public interface CommentMapper {
int insert(Comment comment);//添加评论
int deleteById(long commentId); //删除评论
int update(Comment comment);//修改评论
List<Comment> findByHouseId(long houseId);//查询指定房源的所有评论
List<Comment> findByTenantId(long tenantId);//查询某租户发表的所有评论
Comment findByHouseIdAndTenantId(long houseId, long tenantId);
List<Comment> findAll();
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/CommentMapper.java
|
Java
|
unknown
| 594
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.Favorite;
import java.util.List;
@Mapper
public interface FavoriteMapper {
int insert(Favorite favorite);
int deleteById(long favoriteId);
int deleteByTenantAndHouse(long tenantId, long houseId);
List<Favorite> findAll();
List<Favorite> findByTenantId(long tenantId);
List<Favorite> findByHouseId(long houseId);
Favorite findByTenantAndHouse(long tenantId, long houseId);
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/FavoriteMapper.java
|
Java
|
unknown
| 511
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.House;
import java.util.List;
@Mapper
public interface HouseMapper {
int insert(House house);
int update(House house);
int deleteById(long houseId);
House findById(long houseId);
List<House> findAll();
List<House> findByLandlordId(long landlordId);
List<House> findByStatus(String status);
List<House> findByTitle(String title);
List<House> findByArea(String area);
int updateStatus(long houseId, String status);
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/HouseMapper.java
|
Java
|
unknown
| 564
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.Landlord;
import java.util.List;
@Mapper
public interface LandlordMapper {
int insert(Landlord landlord);//插入新房东
int deleteById(long landlordId);//根据ID删除
int updateById(Landlord landlord);//更新房东信息(不修改ID)
Landlord findById(long landlordId);//根据ID查找房东
Landlord findByUsername(String username);//根据用户名查找房东
List<Landlord> findAll();//查询所有房东
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/LandlordMapper.java
|
Java
|
unknown
| 553
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.Record;
import java.util.List;
@Mapper
public interface RecordMapper {
int insert(Record record);
int deleteById(long recordId);
List<Record> findAll();
List<Record> findByTenantId(long tenantId);
List<Record> findByHouseId(long houseId);
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/RecordMapper.java
|
Java
|
unknown
| 371
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.RentalApplication;
import java.util.List;
@Mapper
public interface RentalApplicationMapper {
int insert(RentalApplication application);
int updateStatus(long applicationId, String status);
RentalApplication findById(long applicationId);
List<RentalApplication> findByTenantId(long tenantId);
List<RentalApplication> findByHouseId(long houseId);
RentalApplication findByTenantIdAndHouseIdAndType(long tenantId, long houseId, String type);
List<RentalApplication> findAll();
int deleteById(long applicationId);
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/RentalApplicationMapper.java
|
Java
|
unknown
| 651
|
package org.example.main.dao;
import org.apache.ibatis.annotations.Mapper;
import org.example.main.entity.Tenant;
import java.util.List;
@Mapper
public interface TenantMapper {
int insert(Tenant tenant);
int deleteById(long tenantId);
int updateById(Tenant tenant);
Tenant findById(long tenantId);
Tenant findByUsername(String username);
List<Tenant> findAll();
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/dao/TenantMapper.java
|
Java
|
unknown
| 392
|
package org.example.main.entity;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Admin",description = "管理员实体")
public class Admin {
@Schema(name = "adminId",description = "管理员id")
private long adminId;
@Schema(name = "username",description = "管理员名")
private String username;
@Schema(name = "password",description = "管理员密码")
private String password;
@Schema(name = "phone",description = "管理员电话")
private String phone;
@Schema(name = "email",description = "管理员邮箱")
private String email;
@Schema(name = "publicKey",description = "公钥")
private String publicKey;
@Schema(name = "privateKey",description = "私钥")
private String privateKey;
public long getAdminId() {
return adminId;
}
public void setAdminId(long adminId) {
this.adminId = adminId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPublicKey() {
return publicKey;
}
public void setPublicKey(String publicKey) {
this.publicKey = publicKey;
}
public String getPrivateKey() {
return privateKey;
}
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/entity/Admin.java
|
Java
|
unknown
| 1,696
|
package org.example.main.entity;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Comment",description = "评论实体")
public class Comment {
@Schema(name = "commentId",description = "评论id")
private long commentId;
@Schema(name = "houseId",description = "房源id")
private long houseId;
@Schema(name = "tenantId",description = "租客id")
private long tenantId;
@Schema(name = "content",description = "内容")
private String content;
@Schema(name = "rating",description = "评分")
private long rating;
@Schema(name = "commentTime",description = "评论时间")
private java.sql.Timestamp commentTime;
public long getCommentId() {
return commentId;
}
public void setCommentId(long commentId) {
this.commentId = commentId;
}
public long getHouseId() {
return houseId;
}
public void setHouseId(long houseId) {
this.houseId = houseId;
}
public long getTenantId() {
return tenantId;
}
public void setTenantId(long tenantId) {
this.tenantId = tenantId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public long getRating() {
return rating;
}
public void setRating(long rating) {
this.rating = rating;
}
public java.sql.Timestamp getCommentTime() {
return commentTime;
}
public void setCommentTime(java.sql.Timestamp commentTime) {
this.commentTime = commentTime;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/entity/Comment.java
|
Java
|
unknown
| 1,505
|
package org.example.main.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
@Schema(name = "Favorite",description = "收藏实体")
public class Favorite {
@Schema(name = "favoriteId",description = "收藏id")
private long favoriteId;
@Schema(name = "tenantId",description = "租客id")
private long tenantId;
@Schema(name = "houseId",description = "房源id")
private long houseId;
@Schema(name = "favoriteTime",description = "收藏时间")
private Date favoriteTime;
public long getFavoriteId() {
return favoriteId;
}
public void setFavoriteId(long favoriteId) {
this.favoriteId = favoriteId;
}
public long getTenantId() {
return tenantId;
}
public void setTenantId(long tenantId) {
this.tenantId = tenantId;
}
public long getHouseId() {
return houseId;
}
public void setHouseId(long houseId) {
this.houseId = houseId;
}
public Date getFavoriteTime() {
return favoriteTime;
}
public void setFavoriteTime(Date favoriteTime) {
this.favoriteTime = favoriteTime;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/entity/Favorite.java
|
Java
|
unknown
| 1,092
|
package org.example.main.entity;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "House",description = "房源实体")
public class House {
@Schema(name = "houseId",description = "房源id")
private long houseId;
@Schema(name = "title",description = "标题")
private String title;
@Schema(name = "description",description = "描述")
private String description;
@Schema(name = "price",description = "价格")
private Double price;
@Schema(name = "address",description = "地址")
private String address;
@Schema(name = "area",description = "区域")
private String area;
@Schema(name = "roomCount",description = "房间数")
private Integer roomCount;
@Schema(name = "floor",description = "楼层")
private Integer floor;
@Schema(name = "landlordId",description = "房东id")
private long landlordId;
@Schema(name = "status",description = "状态")
private String status;
@Schema(name = "imageUrl",description = "图片")
private String imageUrl;
@Schema(name = "size",description = "面积")
private Integer size;
public long getHouseId() { return houseId; }
public void setHouseId(long houseId) { this.houseId = houseId; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public Double getPrice() { return price; }
public void setPrice(Double price) { this.price = price; }
public String getAddress() { return address; }
public void setAddress(String address) { this.address = address; }
public String getArea() { return area; }
public void setArea(String area) { this.area = area; }
public Integer getRoomCount() { return roomCount; }
public void setRoomCount(Integer roomCount) { this.roomCount = roomCount; }
public Integer getFloor() { return floor; }
public void setFloor(Integer floor) { this.floor = floor; }
public long getLandlordId() { return landlordId; }
public void setLandlordId(long landlordId) { this.landlordId = landlordId; }
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
public String getImageUrl() { return imageUrl; }
public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
public Integer getSize() { return size; }
public void setSize(Integer size) { this.size = size; }
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/entity/House.java
|
Java
|
unknown
| 2,506
|
package org.example.main.entity;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Landlord",description = "房东实体")
public class Landlord {
@Schema(name = "landlordId",description = "房东id")
private long landlordId;
@Schema(name = "username",description = "用户名")
private String username;
@Schema(name = "password",description = "密码")
private String password;
@Schema(name = "phone",description = "手机号")
private String phone;
@Schema(name = "email",description = "邮箱地址")
private String email;
public long getLandlordId() {
return landlordId;
}
public void setLandlordId(long landlordId) {
this.landlordId = landlordId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
|
2301_79970562/student_union_backend
|
src/main/java/org/example/main/entity/Landlord.java
|
Java
|
unknown
| 1,240
|