Что такое формат файла PAC?
A .pac file, also known as a Proxy Auto-Config file, is a configuration file used by web browsers and operating systems to automate proxy server connection settings. The .pac file contains a single JavaScript function - FindProxyForURL(url, host) - that specifies which connection mode to use when a browser needs to access a given URL. The function can return DIRECT (connect without a proxy), PROXY host:port (route through an HTTP proxy), or SOCKS host:port, and multiple directives may be chained with semicolons as fallbacks.
The format was introduced by Netscape Communications in 1996 and has remained the de-facto standard for proxy auto-configuration ever since. Because a .pac file is plain JavaScript, it can use built-in PAC helper functions - isInNet(), dnsDomainIs(), shExpMatch(), dnsResolve(), and others - to build complex per-URL routing logic. Extended functions such as isInNetEx() added around 2010 provide IPv6 support.
.pac files are plain text and can be created or edited in any text editor on Windows, macOS, or Linux. In enterprise and network environments they are often distributed automatically via the Web Proxy Auto-Discovery (WPAD) protocol, where the file is served under the well-known name wpad.dat - the same script content in a .dat wrapper. The browser fetches and executes the script each time it connects to a new host. All major browsers - Chrome, Firefox, Edge, and Safari - support .pac files on Windows, macOS, Linux, iOS, and Android.
Безопасность и защита
РИСК: MEDIUMA PAC file is not executable on your system the way a program is - it runs only inside the browser's restricted PAC engine. But it IS security-relevant: because it decides where ALL your web traffic is routed, a malicious or tampered PAC can silently send your traffic (including bank logins) through an attacker's proxy for interception. Unexpected "automatic proxy configuration" settings or a planted .pac/wpad.dat are recognized malware indicators. Only apply PAC files from your own IT department or a source you trust, inspect the FindProxyForURL logic (it's readable plain text), and be wary of WPAD on untrusted networks, which can be hijacked.
Детали формата
в двух словах- Atari STAD image (PackBits) - Obscure compressed bitmap image format from the Atari ST 'STAD' paint program.
- SAMS ARchive (.pac) - Compressed archive created by the SAMS ARchiver packing utility.
- Tencent QQ data file - Internal data/resource file used by the Tencent QQ messenger.
Программы, открывающие файлы PAC
Технические подробности
глубокая спецификация| File type | Plain-text JavaScript source file |
| Core function | FindProxyForURL(url, host) - the single required entry point the browser calls for each connection |
| MIME type | application/x-ns-proxy-autoconfig (also accepted: text/plain, application/x-javascript-config) |
| Text encoding | ASCII / UTF-8 |
| Typical file size | Under 5 KB; large enterprise scripts may reach tens of KB |
| Binary signature | None - identified by the presence of the FindProxyForURL() function declaration |
| Return value syntax | DIRECT, PROXY host:port, or SOCKS host:port; multiple directives chained with semicolons for fallback |
| Built-in helper functions | isInNet(), dnsDomainIs(), shExpMatch(), dnsResolve(), myIpAddress() and related PAC utilities |
| IPv6 extension | isInNetEx(), isResolvableEx() and other Ex-suffixed helpers added ~2010 for IPv6 address matching |
| WPAD integration | Served as wpad.dat under the Web Proxy Auto-Discovery (WPAD) protocol for network-wide auto-distribution |
| Distribution method | Browser or OS fetches the file via an HTTP/HTTPS URL configured in system or browser proxy settings |
| Execution context | Restricted JavaScript sandbox - no DOM access, no arbitrary network calls; only PAC helper functions permitted |
| Supported platforms | Windows, macOS, Linux, iOS, Android - any OS or browser that supports proxy configuration |
| Well-known filenames | proxy.pac (direct URL config) and wpad.dat (WPAD auto-discovery) |
| Выпущен | 1996 (Netscape Navigator 2.0 proxy auto-config) |
| Последняя версия | De-facto stable since 1996; Microsoft added IPv6 helper functions (ex versions) ~2010 |
| Открыть стандартное | Да · без роялти |
| Спецификация | developer.mozilla.org |
Конвертации PAC
Вопросы и ответы сообщества
спрошено пользователямиВопросов пока нет - станьте первым, кто спросит о файлах PAC.