/* HTNoProxy_addRegex ** ------------------ ** Registers a regular expression where URIs matching this expression ** should go directly and not via a proxy. ** */ PUBLIC BOOL HTNoProxy_addRegex (const char * regex, int regex_flags) { if (!noproxy) noproxy = HTList_new(); #ifdef HT_POSIX_REGEX return add_hostname(noproxy, regex, NULL, 0, YES, regex_flags); #else return add_hostname(noproxy, regex, NULL, 0, NO, -1); #endif }
/* HTNoProxy_add ** ------------- ** Registers a host name or a domain as a place where no proxy should ** be contacted - for example a very fast link. If `port' is '0' then ** it applies to all ports and if `access' is NULL then it applies to ** to all access methods. ** ** Examples: w3.org ** www.close.com */ PUBLIC BOOL HTNoProxy_add (const char * host, const char * access, unsigned port) { if (!noproxy) noproxy = HTList_new(); return add_hostname(noproxy, host, access, port, NO, -1); }
static void add_ip6_config (GString *str, const char *hostname) { add_hostname (str, HOSTNAME6_FORMAT "\n", hostname); g_string_append (str, "send fqdn.encoded on;\n" "send fqdn.no-client-update on;\n" "send fqdn.server-update on;\n"); }
/*---------------------------------------------------------------------------*/ static void send_discover(void) { u8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; create_msg(m); end = add_msg_type(&m->options[4], DHCPDISCOVER); end = add_hostname(end); end = add_req_options(end); end = add_end(end); uip_send(uip_appdata, end - (u8_t *)uip_appdata); }
/*---------------------------------------------------------------------------*/ static void send_request(void) { u8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; create_msg(m); end = add_msg_type(&m->options[4], DHCPREQUEST); end = add_server_id(end); end = add_hostname(end); end = add_req_ipaddr(end); end = add_end(end); uip_send(uip_appdata, end - (u8_t *)uip_appdata); }
static void add_ip4_config (GString *str, NMSettingIP4Config *s_ip4, const char *hostname) { if (s_ip4) { const char *tmp; tmp = nm_setting_ip4_config_get_dhcp_client_id (s_ip4); if (tmp) { gboolean is_octets = TRUE; const char *p = tmp; while (*p) { if (!g_ascii_isxdigit (*p) && (*p != ':')) { is_octets = FALSE; break; } p++; } /* If the client ID is just hex digits and : then don't use quotes, * because dhclient expects either a quoted ASCII string, or a byte * array formated as hex octets separated by : */ if (is_octets) g_string_append_printf (str, CLIENTID_FORMAT_OCTETS "\n", tmp); else g_string_append_printf (str, CLIENTID_FORMAT "\n", tmp); } } add_hostname (str, HOSTNAME4_FORMAT "\n", hostname); g_string_append_c (str, '\n'); /* Define options for classless static routes */ g_string_append (str, "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n"); g_string_append (str, "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n"); /* Web Proxy Auto-Discovery option (bgo #368423) */ g_string_append (str, "option wpad code 252 = string;\n"); g_string_append_c (str, '\n'); }
static void add_ip4_config (GString *str, const char *dhcp_client_id, const char *hostname) { if (dhcp_client_id) { gboolean is_octets = TRUE; int i = 0; while (dhcp_client_id[i]) { if ((i % 3) != 2 && !g_ascii_isxdigit (dhcp_client_id[i])) { is_octets = FALSE; break; } if ((i % 3) == 2 && dhcp_client_id[i] != ':') { is_octets = FALSE; break; } i++; } /* If the client ID is just hex digits and : then don't use quotes, * because dhclient expects either a quoted ASCII string, or a byte * array formated as hex octets separated by : */ if (is_octets) g_string_append_printf (str, CLIENTID_FORMAT_OCTETS "\n", dhcp_client_id); else g_string_append_printf (str, CLIENTID_FORMAT "\n", dhcp_client_id); } add_hostname (str, HOSTNAME4_FORMAT "\n", hostname); g_string_append_c (str, '\n'); /* Define options for classless static routes */ g_string_append (str, "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n"); g_string_append (str, "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n"); /* Web Proxy Auto-Discovery option (bgo #368423) */ g_string_append (str, "option wpad code 252 = string;\n"); g_string_append_c (str, '\n'); }
//===================================================================================== // // * Function : RightSpoof() // * Description // 이 함수는 위의 ChildRightProc콜백함수의 WM_SPOOF메시지에 대응하는 메시지 처리 함수 // 이다. wParam로 SM_INIT, SM_CHANGE, SM_ADD등 종류의 메시지를 보내어 탐지모듈들과 // 데이터를 주도받을 수 있다. // //===================================================================================== LRESULT RightSpoof(HWND hWnd, WPARAM wParam, LPARAM lParam) { static PSPOOF_L HEAD=NULL; PSPOOF_L __ARP_LIST=(PSPOOF_L)lParam; INT LIST_index; ARPDATA* arpnode; char hostStr[17]; switch(wParam) { //List View를 초기화할 때 쓰는 메시지이다. case SM_INIT: HEAD=__ARP_LIST; ListView_DeleteAllItems(hWnd); while(__ARP_LIST!=NULL){ AddList(hWnd,__ARP_LIST); __ARP_LIST=__ARP_LIST->next; } ChangeState(); SendMessage(hC2,WM_PAINT,0,0); break; //List View의 해당 인덱스를 변경할 때 쓰는 메시지이다. case SM_CHANGE: LIST_index=ChatchChange(hWnd,__ARP_LIST,HEAD); ChangeList(LIST_index); /* 의심이나 공격상황에 트레이 발생*/ if(__ARP_LIST->flag==SUSPICIOUS || __ARP_LIST->flag==ATTACK){ nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = hWndMain; nid.uID = 0; nid.uFlags = NIF_ICON|NIF_TIP|NIF_MESSAGE|NIF_INFO; nid.dwInfoFlags = 0x0006; nid.uTimeout = 500; nid.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ICON1)); lstrcpy(nid.szInfoTitle, TEXT("주의상황")); wsprintf(nid.szTip, TEXT("의심스러운 %d.%d.%d.%d"), __ARP_LIST->ipAddr[0],__ARP_LIST->ipAddr[1],__ARP_LIST->ipAddr[2],__ARP_LIST->ipAddr[3]); wsprintf(nid.szInfo, TEXT("의심스러운 %d.%d.%d.%d가 프로그램에 포착되었습니다."), __ARP_LIST->ipAddr[0],__ARP_LIST->ipAddr[1],__ARP_LIST->ipAddr[2],__ARP_LIST->ipAddr[3]); Shell_NotifyIcon(NIM_MODIFY, &nid); } break; //List View를 더할 때 쓰는 메시지이다. case SM_ADD: get_hostname(__ARP_LIST->ipAddr, hostStr); add_hostname(ARP_LIST,__ARP_LIST->ipAddr,hostStr); AddList(hWnd,__ARP_LIST); break; case SM_NODEVICE: MessageBox(hWnd,TEXT("인터페이스를 찾을수 없습니다.\nWinpcap이 설치 되었는지 확인해 주시기 바랍니다."),TEXT("알림"),MB_OK); break; case SM_STOP_THREAD: SuspendThread(hThread); break; case SM_RESUME_THREAD: ResumeThread(hThread); break; case SM_UPDATE_HOSTNAME: LIST_index=ChatchChange(hWnd,__ARP_LIST,HEAD); ChangeList(LIST_index); break; case SM_UPDATE_LIST_NOMAL: arpnode = (ARPDATA*)lParam; updateState(ARP_LIST,NOMAL,arpnode->ipAddr,arpnode->macAddr, arpnode->vendor,arpnode->timestr," "); break; case SM_UPDATE_LIST_SUSP: arpnode = (ARPDATA*)lParam; updateState(ARP_LIST,SUSPICIOUS,arpnode->ipAddr,arpnode->macAddr, arpnode->vendor,arpnode->timestr," "); break; case SM_UPDATE_LIST_ATTACK: arpnode = (ARPDATA*)lParam; updateState(ARP_LIST,ATTACK,arpnode->ipAddr,arpnode->macAddr, arpnode->vendor,arpnode->timestr," "); break; case SM_UPDATE_LIST_STATIC: arpnode = (ARPDATA*)lParam; updateState(ARP_LIST,STATIC,arpnode->ipAddr,arpnode->macAddr, arpnode->vendor,arpnode->timestr," "); } return 0; }
/* * Main prwd functionality, prints a reduced working directory. */ void prwd(void) { size_t len; int found_repo = 0; char *wd = NULL; char *wd_env = NULL; char mbs_wd[MAX_OUTPUT_LEN]; wchar_t wcs_wd[MAX_OUTPUT_LEN]; struct stat sa, sb; wd = getcwd(NULL, MAXPATHLEN); if (wd == NULL) errx(100, "unable to get current working directory"); if (stat(wd, &sa) == -1) err(100, "stat(wd_real)"); /* * If we can get a valid PWD from the environment, that turns out to be * the same directory, then we should use it, it provides more context * if the shell is located in a symlink. */ wd_env = getenv("PWD"); if (wd_env != NULL && stat(wd_env, &sb) == 0) { if (sa.st_ino == sb.st_ino && sa.st_dev == sb.st_dev) { free(wd); wd = wd_env; } } mbstowcs(wcs_wd, wd, MAX_OUTPUT_LEN); /* Replace the beginning with ~ for directories within $HOME. */ add_alias(L"~", home, 0); /* Alias handling */ replace_aliases(wcs_wd); /* Newsgroup mode, keep only the first letters. */ if (cfg_newsgroup == 1) newsgroupize(wcs_wd); /* If the path is still too long, crop it. */ len = wcslen(wcs_wd); if (cfg_maxpwdlen > 0 && len > cfg_maxpwdlen) { if (cfg_cleancut == 1 && cfg_newsgroup != 1) { cleancut(wcs_wd); } else { quickcut(wcs_wd, len); } } /* If mercurial or git is enabled, show the branch */ if (cfg_mercurial == 1) { found_repo = add_branch(wcs_wd, VCS_MERCURIAL); } if (found_repo == 0 && cfg_git == 1) { add_branch(wcs_wd, VCS_GIT); } /* Do we show the hostname? */ if (cfg_hostname == 1) { add_hostname(wcs_wd); } /* Add the '$' or '#' character depending if your root. */ if (cfg_uid_indicator == 1) { add_uid_indicator(wcs_wd); } wcstombs(mbs_wd, wcs_wd, MAX_OUTPUT_LEN); puts(mbs_wd); }