From 1382569278aac7de2453b9f49b9b74f768f7cf80 Mon Sep 17 00:00:00 2001 From: git-user-cpp Date: Sat, 13 Jan 2024 10:39:34 +0200 Subject: [PATCH 1/2] net info --- main | Bin 0 -> 16656 bytes src/main.c | 8 ++++++++ src/net/net_info.h | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100755 main create mode 100644 src/net/net_info.h diff --git a/main b/main new file mode 100755 index 0000000000000000000000000000000000000000..27e3871bcd044ce0ba50ce40a6da9f5e25ae5836 GIT binary patch literal 16656 zcmeHOeQ+Gbm2XKl2*s8J*qng_&k;WC#JiF|aEw79*EL+$z*p$h5rJdDoyxLuM zXN5%BAR-GS)=G&~_{fn<9FjVm94T}m4nC(${I8bw*H z;K^<#RVDAIv#SM8QKfg<(}bS+Xs_&$qHa6N&Ax!J+t=Www#>^(NtGS3WOqQ?9gud4 zGKH5^<&$zke=B4@{ZxaFipGB#^V@Bac7D1>;uWPfsBC)Giu`ZdYm;^ht`vU!)DmK* zsA}&f*il|SYf;0zQMOlV9Ja_jDoW!`r7jWgSiY<-5eX#X$y{%scg6C+@@2tnD!7E} zDK2V*=G5Btn^}238z-5vr}`ZHQCdmA^&5#Rmn}Q^PW1cHwZHkr!{1zY$%!uIgKP*x zg=F-n3hC6Jl6@BX4nXHk0erlK{1V8uDe#Y$!2i00{Ocv;MhQ9fO~aqREP_Du3&FSH z@3JZ6--ApZvOL-ea8u=>xrF>g3Hf~`~hISwhZ?miAU7 zVrI;)c-AsA?X9a5sifH+?ns!-FuJ-^Nh528GnQcp=#;>C(zJ}El?ub8vo~x+L$ zey7QzU8a>~*}iN%8BMXQmFdi;lK^2AbxOb8;dqj3y3;J0N}EX*?M$SyCd(zm-6k{< z=;0=o%32+LQWmy)qFENrm}Wd0jzlt9mNqk)REB^`V)n)@G==CpcNm?q9Y!=9Pq1_* zp0uJ20VJ~tTDME7o-wnjM2}d;6dTo+v$gA5R;@Oc1eY#zs*|;)j%-QrYGk(@|H}BU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!;Ihld7u5>D@8ks9{1%>jh{d<_V1|B8+3BnIQJ9O_qTq$;uZZZY;iT= z*sJ>uV*vuO4mDX`~F6O>z56yIF%b^=kPElnTlVX-;PRqKc3oh zm)Wv?e?OJIU#{%kRLwoN-*IU;CMO&nhiRNtJnHyK_hD4*Zu>NSdWkaAr&R3 +#include +#include +#include +#include +#include + +void print_net_info(char *hostname){ + struct hostent *host = gethostbyname(hostname); + if(host == NULL){ + perror("gethostbyname"); + exit(1); + } else { + printf("Host Name: %s\n", host->h_name); + printf("IP Address: "); + for(int i = 0; host->h_addr_list[i] != NULL; i++){ + printf("%s ", inet_ntoa(*(struct in_addr *)host->h_addr_list[i])); + } + printf("\n"); + } + + struct ifaddrs *ifaddr, *ifa; + if(getifaddrs(&ifaddr) == -1) { + perror("getifaddrs error"); + exit(1); + } + for(ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next){ + if(ifa->ifa_addr != NULL && ifa->ifa_addr->sa_family == AF_INET){ + printf("Interface: %s\n", ifa->ifa_name); + printf("Address: %s\n", inet_ntoa(((struct sockaddr_in*)ifa->ifa_addr)->sin_addr)); + printf("Netmask: %s\n", inet_ntoa(((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr)); + } + } + + freeifaddrs(ifaddr); +} From db44536de06434131fccd6e4117fee42f1ed2205 Mon Sep 17 00:00:00 2001 From: git-user-cpp Date: Sat, 13 Jan 2024 10:52:33 +0200 Subject: [PATCH 2/2] v2.1.0 --- main | Bin 16656 -> 0 bytes src/hlp/hlp_info.h | 21 +++++++++++---------- src/main.c | 2 +- src/net/net_info.h | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) delete mode 100755 main diff --git a/main b/main deleted file mode 100755 index 27e3871bcd044ce0ba50ce40a6da9f5e25ae5836..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16656 zcmeHOeQ+Gbm2XKl2*s8J*qng_&k;WC#JiF|aEw79*EL+$z*p$h5rJdDoyxLuM zXN5%BAR-G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