注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

网路游侠

www.youxia.org

 
 
 

日志

 
 

smoothwall v2.0 汉化包  

2006-01-08 14:48:13|  分类: 02 游侠·原创 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

    《黑客X档案》第五期“主题乐园”中雪莲蓬介绍给大家一款软路由防火墙:SmoothWall。软件是很好,但是却要我们面对e文的界面,感觉实在不爽。雪莲蓬说了汉化的方法,但是却给我们一句:“用点耐心慢慢的汉化吧!”——唉,命苦的人啊!

    只有自己动手了:雪莲蓬说的两个文件:./var/smoothwall下的header.pl和./var/smoothwall/langs下的base.pl主要界面都汉化了,只要覆盖原来的文件就可以了。初次做汉化,可能有些词语翻译的不好,希望大家批评指正!

    给自己做一点广告:www.youxia.orgwww.xijing.org 我的小站,欢迎大家光临!淄博或者西安的朋友可以留言我们见面。呵呵 ^_^


    —— 和你一样爱看X的:网路游侠 :)

    文件名自己搜索,比较长,sohu的blog不支持传rar或者别的格式的附件,只能这样子了。

Base.pl内容:

# SmoothWall CGIs
#
# This code is distributed under the terms of the GPL
#
# (c) The SmoothWall Team

%basetr = (

# common

'invalid input' => '无效的输入',
'save' => '保存', # button
'refresh' => '刷新', # button
'restore' => '还原', # button
'error messages' => '错误信息:',
'back' => '后退',
'help' => '帮助',
'primary dns' => '主DNS:',
'secondary dns' => '辅DNS:',
'invalid primary dns' => '无效的主DNS.',
'invalid secondary dns' => '无效的辅DNS.',
'dhcp server' => 'DHCP服务器',
'username' => '用户名:',
'password' => '密码:',
'enabled' => 'Enabled:',
'this field may be blank' => '这里可以为空.',
'these fields may be blank' => '这些地方可以为空.',

# header.pl
'sshome' => '首页',
'ssstatus' => '状态',
'ssadvstatus' => '高级',
'sstraffic graphs' => '流量图示',
'sssquid graphs' => 'squid graphs',
'ssppp settings' => 'PPP设置',
'ssmodem' => 'Modem',
'ssusb adsl firmware upload' => 'alcatel speedtouch USB ADSL 固件更新',
'ssremote access' => '远程访问',
'sspasswords' => '密码',
'ssweb proxy' => 'WEB代理',
'ssdhcp' => 'DHCP',
'ssport forwarding' => '端口转发',
'ssexternal service access' => '外部服务访问',
'ssdmz pinholes' => 'DMZ设定',
'ssdynamic dns' => '动态DNS',
'ssids' => '入侵检测系统',
'sscontrol' => '控制',
'ssconnections' => '连接',
'ssother' => '其它',
'ssfirewall' => '防火墙',
'ssshutdown' => '关闭',
'ssshell' => 'Shell',
'ssupdates' => '更新',
'sshelp' => '帮助',
'sscredits' => '参与者',
'ssip info' => 'IP消息',
'sstime' => '时间',
'ssip tools' => 'IP工具',
'ssadvanced' => '高级',
'ssip block' => 'IP阻塞',
'ssbackup' => '撤销',
'powered by' => 'powered by',
'alt home' => '首页', # alt
'alt information' => '信息', # alt
'alt dialup' => '拨号', # alt
'alt remote access' => '远程访问', # alt
'alt services' => '服务', # alt
'alt ids' => '入侵检测系统', # alt
'alt vpn' => '虚拟专用网(VPN)', # alt
'alt logs' => '日志', #alt
'alt shutdown' => '关闭', # alt
'alt shell' => 'Shell', # alt
'alt updates' => '更新', # alt

# changepw.cgi
'admin user password has been changed' => '管理员密码已经被改变.',
'dial user password has been changed' => '拨号用户密码已经被改变.',
'password cant be blank' => '密码不能为空.',
'passwords do not match' => '密码不匹配.',
'change passwords' => '修改密码',
'administrator user password' => '管理员密码:',
'dial user password' => '拨入用户密码:',
'again' => '重复:',
'passwords must be at least 6 characters in length' => '密码长度至少为6位',
'password contains illegal characters' => '密码包含非法字符.',

# credits.cgi
'credits' => '参与者',
'version' => '版本: ',
'sponsors' => '发起人',
'links' => '链接',
'smoothwall homepage' => 'SmoothWall主页',
'translation teams' => '翻译团队',

# dhcp.cgi
'invalid start address' => '无效的开始地址.',
'invalid end address' => '无效的结束地址.',
'cannot specify secondary dns without specifying primary' => '未指定主DNS之前不能指定辅DNS.',
'cannot specify secondary wins without specifying primary' => '未指定主WINS之前不能指定辅WINS.',
'invalid default lease time' => '无效的默认租约时间.',
'invalid max lease time' => '无效的最大租借地址.',
'dhcp server enabled' => 'DHCP服务开启.  重启.',
'dhcp server disabled' => 'DHCP服务器禁止.  停止.',
'dhcp configuration' => 'DHCP配置',
'start address' => '开始地址:',
'end address' => '结束地址:',
'default lease time' => '默认租约时间 (分钟):',
'max lease time' => '最大租约时间 (分钟):',
'domain name suffix' => '域名后缀:',
'primary wins' => '主WINS:',
'secondary wins' => '辅WINS:',
'invalid primary wins' => '无效的主WINS.',
'invalid secondary wins' => '无效的辅WINS',
'mac address not valid' => 'MAC地址无效.',
'ip address not valid' => 'IP地址无效.',
'add a new static assignment' => '添加一个新的静态分配:',
'mac addressc' => 'MAC地址:',
'ip addressc' => 'IP地址:',
'mac address' => 'MAC地址',
'ip address' => 'IP地址',
'note' => '注意:',
'there are unsaved changes' => '列表中改变的静态分配没有保存. 请点击保存激活.',
'current static assignments' => '当前静态分配:',
'descriptionc' => '描述:',
'description' => '描述',
'please enter a description' => '请输入一个描述.',
'description contains bad characters' => '描述包含无效的字符.',

# proxy.cgi
'web proxy configuration' => 'Web代理配置',
'web proxyc' => 'Web代理:',
'cache size' => '缓存大小 (MB):',
'invalid cache size' => '无效的缓存大小.',
'remote proxy' => '远程代理:',
'remote proxy username' => '远程代理用户:',
'remote proxy password' => '远程代理密码:',
'invalid maximum object size' => '无效的最大包尺寸.',
'invalid minimum object size' => '无效的最大包尺寸.',
'invalid maximum outgoing size' => '无效的最大外出包尺寸.',
'invalid maximum incoming size' => '无效的最大进入包尺寸.',
'transparent' => '透明的:',
'max size' => '最大包大小 (KB):',
'min size' => '最小包大小 (KB):',
'max outgoing size' => '最大外出包大小 (KB):',
'max incoming size' => '最大进入包大小 (KB):',

# common to logs cgis
'january' => '一月',
'february' => '二月',
'march' => '三月',
'april' => '四月',
'may' => '五月',
'june' => '六月',
'july' => '七月',
'august' => '八月',
'september' => '九月',
'october' => '十月',
'november' => '十一月',
'december' => '十二月',
'month' => '月:',
'day' => '日:',
'update' => '更新', # button
'export' => '输出', # button
'older' => '旧的',
'newer' => '新的',
'settingsc' => '设置:',

# logs.cgi/firewalllog.dat
'firewall log' => '防火墙日志',
'firewall log2' => '防火墙日志:',
'date' => '日期:',
'time' => '时间',
'action' => '动作',
'in' => '进入',
'out' => '外出',
'iface' => 'Iface',
'protocol' => '协议',
'source' => '源',
'src port' => '源端口',
'destination' => '目的',
'dst port' => '目的端口',
'unknown' => '未知的',
'lookup' => 'Lookup',
'add to ip block' => '添加到IP阻塞列表',

# logs.cgi/log.dat
'log viewer' => '日志浏览',
'section' => '分段:',
'kernel' => '内核',
'loginlogout' => '登录/退出',
'update transcript' => '更新资料',
'log' => '日志:',

# logs.cgi/proxylog.dat
'proxy log viewer' => '代理日志浏览',
'bad ignore filter' => '错误的忽略过滤:',
'caps all' => '全部',
'ignore filterc' => '忽略过滤:',
'enable ignore filterc' => '允许忽略过滤:',
'source ip' => '源IP',
'website' => '网站',

# logs.cgi/ids.dat
'ids log viewer' => 'IDS日志浏览',
'datec' => '日期:',
'namec' => '名字:',
'priorityc' => '优先:',
'typec' => '类型:',
'ipinfoc' => 'IP信息:',
'referencesc' => '索引:',
'none found' => '没有找到',

# index.cgi
'main page' => '主页',
'dial' => '连接', # button
'hangup' => '断开', # button
'current profile' => '当前属性:',
'connected' => '已连接',
'dialing' => '拨号中...',
'modem idle' => 'Modem空闲',
'isdn idle' => 'ISDN空闲',
'profile has errors' => '配置有错误',
'modem settings have errors' => 'Modem设置有错误',
'user pages' => '用户页面',
'mstatus information' => '状态信息',
'mnetwork traffic graphs' => '网络传输图示',
'administrator pages' => '管理员页面',
'mppp setup' => 'PPP设置',
'mmodem configuration' => 'Modem配置',
'mchange passwords' => '改变密码',
'mremote access' => '远程访问',
'mdhcp configuration' => 'DHCP配置',
'mproxy configuration' => 'Proxy配置',
'mport forwarding configuration' => '端口转发配置',
'mshutdown control' => '关机控制',
'mlog viewer' => '日志浏览',
'mfirewall log viewer' => '防火墙日志浏览',
'msecure shell' => 'Secure SHell',
'modem dod waiting' => 'Modem拨号按需等待',
'isdn dod waiting' => 'ISDN拨号按需等待',
'pppoe idle' => 'PPPOE空闲',
'adsl idle' => 'ADSL空闲',
'pppoe dod waiting' => 'PPPOE拨号按需等待',
'there are updates' => '这里有可用的系统更新. 请"更新"获取更多信息.',
'updates is old1' => '您的升级文件是 ',
'updates is old2' => '旧的. 我们建议您到"更新"页面升级.',

# pppsetup.cgi
'profile name not given' => '没有给出配置名称.',
'telephone not set' => '电话没有设置.',
'bad characters in the telephone number field' => '电话号码区有无效字符.',
'username not set' => '用户名没有设置.',
'spaces not allowed in the username field' => '用户名不能包含空格.',
'password not set' => '密码没有设置.',
'spaces not allowed in the password field' => '密码不能包含空格.',
'idle timeout not set' => '空闲超时没有设置.',
'only digits allowed in the idle timeout' => '空闲超时只允许填写数字.',
'bad characters in script field' => '错误字符在脚本区',
'max retries not set' => '最大重试值没有设置.',
'only digits allowed in max retries field' => '重试区只允许填写数字.',
'profile saved' => '配置保存: ',
'select' => '选择', # button
'profile made current' => '配置成当前运行: ',
'the selected profile is empty' => '选择的配置是空的.',
'delete' => '删除', # button
'profile deleted' => '配置删除: ',
'empty' => '空',
'unnamed' => '未命名',
'ppp setup' => 'PPP设置',
'profiles' => '配置:',
'profile name' => '配置名称:',
'telephony' => '电话:',
'interface' => '接口:',
'modem on com1' => 'Modem on COM1',
'modem on com2' => 'Modem on COM2',
'modem on com3' => 'Modem on COM3',
'modem on com4' => 'Modem on COM4',
'isdn tty' => 'ISDN on TTY',
'isdn1' => 'Single ISDN',
'isdn2' => 'Dual ISDN',
'computer to modem rate' => '计算modem速率:',
'number' => '号码:',
'modem speaker on' => 'Modem扬声器打开:',
'dialing mode' => '拨号模式:',
'tone' => '双音频',
'pulse' => '脉冲',
'maximum retries' => '最大重试次数:',
'idle timeout' => '空闲超时 (分钟; 禁止为0):',
'persistent connection' => '断线重连:',
'authentication' => '认证方式:',
'method' => '类型:',
'pap or chap' => 'PAP or CHAP',
'standard login script' => '标准登录脚本',
'demon login script' => '进程登录脚本',
'other login script' => '其它登录脚本',
'script name' => '脚本名:',
'type' => '类型:',
'manual' => '手工',
'automatic' => '自动',
'dod' => '按需拨号:',
'dod for dns' => '为DNS按需拨号:',
'connect on smoothwall restart' => '重启SmoothWall时连接:',
'pppoe settings' => '添加PPPoE设置:',
'adsl settings' => '添加ADSL设置:',
'service name' => '服务名称:',
'concentrator name' => '集线器名称:',
'vpi number' => 'VPI Number:',
'vci number' => 'VCI Number:',
'firmwarec' => 'Firmware固件:',
'firmware present' => '显示Firmware固件',
'firmware not present' => '<B>不</B> 显示Firmware',
'upload usb adsl firmware' => '上传USB ADSL固件',
'no usb adsl firmware' => '不是USB ADSL固件.请上传.',
'dial on demand for this interface is not supported' => '这个接口不支持按需拨入.',
'unable to alter profiles while red is active' => '红色的是活动的,不能改变配置.',
'automatic reboot' => '如果连接中断5分钟自动重启',

# remote.cgi
'ssh is enabled' => 'SSH 允许.  重启.',
'ssh is disabled' => 'SSH 禁止.  停止.',
'remote access' => '远程访问',
'remote access2' => '远程访问:',
'secure admin' => '只允许合法URLs的远程管理访问:',
'secure admin long' => 'In order to be certain that the request for an admin function is from the SmoothWall server and not some third party web page? a referral check is done. Enabling this feature means it is only possible to administer the SmoothWall if the URL you visit contains either the local GREEN IP, the local hostname, or the RED IP address. It will not be possible to administer the SmoothWall if you connect via a DNS or Dynamic DNS name.',

# shutdown.cgi
'shutting down smoothwall' => '关闭SmoothWall',
'shutdown control' => '关闭控制',
'shutdown' => '关闭', # button
'shutdown2' => '关闭:',
'shutting down' => '正在关闭',
'smoothwall is shutting down' => 'SmoothWall正在关闭.',
'rebooting smoothwall' => '重启SmoothWall',
'reboot' => '重启', # button
'rebooting' => '正在重启',
'smoothwall is rebooting' => 'SmoothWall正在重启.',

# status.cgi
'web server' => 'Web服务',
'cron server' => 'CRON(守护程序)服务',
'dns proxy server' => 'DNS代理服务',
'logging server' => '日志服务',
'kernel logging server' => '内核日志服务',
'secure shell server' => 'Secure Shell服务',
'vpn' => '虚拟专用网',
'web proxy' => 'Web代理',
'intrusion detection system' => '入侵检测系统',
'status information' => '状态信息',
'advanced status information' => '高级状态信息',
'services' => '服务:',
'memory' => '内存:',
'uptime and users' => '正常运行时间和用户:',
'interfaces' => '接口:',
'routing' => '路由:',
'disk usage' => '磁盘用法:',
'inode usage' => '索引应用:',
'loaded modules' => '加载模块:',
'kernel version' => '内核版本:',
'stopped' => '停止',
'running' => '运行',
'swapped' => '交换',

# portfw.cgi and dmzhole.cgi and xtaccess.cgi
'source port numbers' => '源端口必须为数字.',
'source ip bad' => '不是有效的IP或网络地址.',
'destination ip bad' => '无效的目的IP',
'destination port numbers' => '目的端口必须为数字.',
'unable to open file' => '不能打开文件',
'source port in use' => '源端口在使用:',
'forwarding rule added' => '转发规则添加; 重设转发',
'forwarding rule removed' => '转发规则删除; 重设转发',
'external access rule added' => '外部访问规则添加; 重设访问控制r',
'external access rule removed' =>' 外部访问规则删除; 重设访问控制',
'dmz pinhole rule added' => 'DMZ设置规则添加; 重设DMZ规则',
'dmz pinhole rule removed' => 'DMZ设置规则删除; 重设DMZ规则',
'port forwarding configuration' => '端口转发配置',
'dmz pinhole configuration' => 'DMZ设置配置',
'external access configuration' => '外部访问配置',
'add a new rule' => '添加新规则:',
'sourcec' => '外部源IP或网络(空白为"ALL"):',
'source ipc' => '源IP:',
'source port or rangec' => '源端口或范围:',
'destination ipc' => '目的IP:',
'destination portc' => '目的端口:',
'current rules' => '当前规则:',
'source ip' => '源IP',
'source ip or networkc' => '源IP或网络:',
'source port' => '源端口',
'destination ip' => '目的IP',
'destination port' => '目的端口',
'add' => '添加', # button
'remove' => '删除', # button
'edit' => '编辑', # button
'enabledtitle' => 'Enabled',
'nothing selected' => '没有选择',
'you can only select one item to edit' => '你只能选择一条编辑',
'mark' => '标记',
'all' => '全部',
'portfw destination port' => '如果为空,源端口将被用作目的端口',
'ip block rule added' => 'IP阻塞规则添加.',
'ip block rule removed' => 'IP阻塞规则删除.',
'ip block configuration' => 'IP阻塞配置.',
'log' => '日志',
'logc' => '日志:',
'action' => '作用',
'drop packet' => '丢弃包',
'reject packet' => '拒绝包',
'external ip long' => '外部IP或网络 (空白为"ALL"):',
'external ip' => '外部 IP',


# ddns.cgi
'dynamic dns' => '动态DNS',
'add a host' => '添加主机:',
'servicec' => '服务:',
'behind a proxy' => '在代理之后:',
'enable wildcards' => '允许通配符:',
'hostnamec' => '主机名:',
'domainc' => '区域:',
'current hosts' => '当前主机:',
'service' => '服务',
'hostname' => '主机名',
'domain' => '区域',
'proxy' => '代理',
'wildcards' => '通配符',
'hostname not set' => '主机名没有设置.',
'domain not set' => '区域没有设置.',
'invalid hostname' => '无效的主机名.',
'invalid domain name' => '无效的区域名.',
'hostname and domain already in use' => '主机名和区域已经在使用.',
'ddns hostname added' => '动态DNS主机名添加',
'ddns hostname removed' => '动态DNS主机名删除',
'force update' => '强制更新',

# iptools.cgi and whois.cgi
'ip info' => 'IP信息',
'lookup failed' => '逆向解析失败',
'network utilities' => '网络实用程序',
'select tool' => '选择工具:',
'toolc' => '工具:',
'ip addresses or hostnames' => 'IP地址或主机名:',
'run' => '运行', # button
'could not resolve' => '不能分辨 ',
'whois lookup' => 'Whois查找',
'whois lookupc' => 'Whois查找:',
'ip addresses or domain names' => 'IP地址或域名:',

# shell.cgi
'secure shellc' => 'Secure SHell:',

# modem.cgi
'restore defaults' => '恢复默认', # button
'timeout must be a number' => '超时时间必须是数字.',
'modem configuration' => 'Modem配置',
'modem configurationc' => 'Modem配置:',
'init string' => '初始化:',
'hangup string' => '挂断:',
'speaker on' => '蜂鸣器打开:',
'speaker off' => '蜂鸣器关闭:',
'tone dial' => '音频拨号:',
'pulse dial' => '脉冲拨号:',
'connect timeout' => '连接超时:',
'send cr' => 'ISP需要回车:',

# vpnmain.cgi
'restart' => '重启',
'stop' => '停止',
'vpn configuration main' => 'VPN设置 - Main',
'main' => 'Main',
'connections' => '连接',
'global settingsc' => '全局设置:',
'local vpn ip' => '本地 VPN IP:',
'if blank the currently configured ethernet red address will be used' => '如果为空,当前配置的以太网地址将被使用.',
'manual control and status' => '手工控制状态:',
'connection name' => '名称',
'connection status' => '状态',
'capsclosed' => '已关闭',
'capsdisabled' => '被禁止',
'capsopen' => '打开',

# vpn.cgi/vpnconfig.dat
'name must only contain characters' => '名字必须只包含字符.',
'left ip is invalid' => '左边IP无效.',
'left next hop ip is invalid' => '左边的下一跳IP无效.',
'left subnet is invalid' => '左边的掩码无效.',
'right ip is invalid' => '右边IP无效.',
'right next hop ip is invalid' => '有变的下一跳IP无效.',
'right subnet is invalid' => '有变的掩码无效.',
'vpn configuration connections' => 'VPN配置-连接',
'add a new connection' => '添加一个新连接:',
'namec' => '名称:',
'leftc' => '左边:',
'left next hopc' => '左边下一跳:',
'left subnetc' => '左边掩码:',
'rightc' => '右边:',
'right next hopc' => '右边下一跳:',
'right subnetc' => '右边掩码:',
'secretc' => '加密:',
'current connections' => '当前连接:',
'markc' => '标记:',
'import and export' => '导入和导出:',
'import' => '导入', # button

# graphs.cgi
'network traffic graphs' => '网络流量图示',
'network traffic graphsc' => '网络流量图示:',
'no graphs available' => '没有获得图示.',
'no information available' => '没有获得信息.',

# usbadsl.cgi
'usb adsl setup' => 'Alcatel SpeedTouch USB ADSL setup',
'usb adsl help' => 'To utilise the Alcatel SpeedTouch USB modem you must upload the firmware to your SmoothWall box. Please download the tarball from Alcatel and then upload the file <B>mgmt.o</B> using the form below.',
'upload' => '更新', # button
'upload successful' => '更新成功.',
'could not create file' => '不能创建文件.',
'mgmt upload' => 'Alcatel SpeedTouch USB ADSL驱动上传:',
'upload filec' => '更新文件:',

# updates.cgi
'updates' => '更新',
'could not open available updates file' => '不能打开获得的更新文件.',
'could not download the available updates list' => '不能下载可用的更新列表.',
'could not create directory' => '不能创建目录.',
'could not open updatefile for writing' => '不能为写入打开更新文件.',
'this is not an authorised update' => '这不是有效的更新, 或者你的补丁列表过期了.',
'this is not a valid archive' => '这不是一份有效的存档.',
'could not open update information file' => '不能打开更新信息文件.更新文件被损坏.',
'this update is already installed' => '这个升级已经安装了.',
'package failed to install' => '程序安装失败.',
'update installed but' => '更新已安装,但是安装的包数据库不能更新',
'refresh update list' => '刷新更新列表', # button
'installed updates' => '安装更新:',
'id' => 'ID',
'title' => '标题',
'description' => '描述',
'released' => '释放',
'installed' => '安装',
'could not open installed updates file' => '不能打开安装更新文件',
'available updates' => '更新升级:',
'there are updates available' => '这里有系统可用的更新.强烈推荐您尽快安装.',
'info' => '信息',
'all updates installed' => '所有更新已安装',
'install new update' => '安装新的更新:',
'to install an update' => '安装一个更新请先上传.tar.gz文件:',
'upload update file' => '上传更新文件:',
'could not download latest patch list' => '不能下载最新的补丁列表(没有连接).',
'could not connect to smoothwall org' => '不能连接到smoothwall.org',
'successfully refreshed updates list' => '成功刷新更新列表.',
'the following update was successfully installedc' => '下列更新被成功安装:',

# ids.cgi
'snort is enabled' => 'Snort开启',
'snort is disabled' => 'Snort被禁止',
'intrusion detection system2' => '入侵检测系统:',


# time.cgi
'time settings' => '时间设置',             
'timezonec' => '时区:',                     
'time and datec' => '时间和日期:',
'timec' => '时间:', 
'datec' => '日期:',  
'setc' => '设置:',
'bad ntp host' => '用户定义的服务器名或IP没有设置.',
'setting time' => '设置时间.',
'network time retrieval' => '网络时间检索:',
'interval' => '间隔:',
'one hour' => '1小时',
'two hours' => '2小时',
'three hours' => '3小时',
'six hours' => '6小时',
'twelve hours' => '12小时',
'one day' => '1天',
'two days' => '天',
'three days' => '3天',
'save time to rtc' => '保存时间到RTC:',
'network time servers' => '网络时间服务器:',
'multiple random public servers' => '多个随机公共服务器',
'selected single public server' => '选择一个公共服务器:',
'user defined single public or local server' => '用户定义的公共服务器或本地服务器:',
'next update in' => '下次更新在:',
'hours' => ' 小时',
'less than one hour' => '超过一小时r',

# advnet.cgi
'restarting advanced networking features' => '重启高级网络功能.',
'advanced networking features' => '高级网络功能',
'advanced networking featuresc' => '高级网络功能:',
'block icmp ping' => '阻塞ICMP ping:',
'enable syn cookies' => '允许SYN cookies:',
'block and ignore igmp packets' => '阻塞和过滤IGMP包:',
'block and ignore multicast traffic' => '阻塞和过滤组播传输:',
'upnp support' => '开启UPnP (通用即插即用)支持:',

# backup.cgi
'create backup floppy disk' => '创建Backup软盘', # button
'unable to create backup floppy' => '不能创建Backup软盘. 检查驱动器中软盘是否可以写入.',
'backup configuration' => 'Backup配置',
'backup floppy instructions' => '命令创建Backup磁盘或镜像:',
'backup floppy instructions long' => '在按下创建按钮前请插入一张空白的格式化过的软盘到SmoothWall计算机的驱动器.  This disk should  be available when reinstalling or upgrading, in order for the saved configuration to be restored.  It may take up to a minute to write the information to the floppy disk. Alternatively, you may create a floppy disk image file, which you can later write to a floppy disk.',
'backup disk created successfully' => 'Backup盘创建成功.',
'create backup floppy image file' => '创建Backup软盘镜像文件',
'unable to create backup floppy image file' => '不能创建Backup软盘镜像文件',
'save and restart with cleared cache' => "保存并清空缓存",
'RRDTool graphs' => 'RRD工具Graphs',


# Advanced Status Page

'adv total'   => '总计',
'adv used'    => '使用',
'adv free'    => '空闲',
'adv used%'   => '使用 %',
'adv shared'  => '共享',
'adv buffers' => '缓冲',
'adv cached'  => '缓存',
'adv filesystem'  => '文件系统',
'adv mount point' => '挂接点',
'adv size'        => '大小',
'adv available'  => '可用',
'adv inodes'     => '节点s',
);

Header.pl内容:

# SmoothWall CGIs
#
# This code is distributed under the terms of the GPL
#
# (c) The SmoothWall Team

$|=1; # line buffering

$version = '2.0';
$revision = 'p0';
$webuirevision = 'ui-3.6.1';
$swroot = '/var/smoothwall';
$pagecolour = '#ffffff';
#$tablecolour = '#a0a0a0';
$tablecolour = '#ffffff';
$bigboxcolour = '#ffffff';
$boxcolour = '#ffcc66';
$bordercolour = '#000000';
$table1colour = '#ff9900';
$table2colour = '#ffee88';
$colourred = '#a01010';
$colourorange = '#ff9900';
$colourgreen = '#10a010';
$colourlightred = '#ff6060';
$colourlightgreen = '#60ff60';
$primarynavsel = '#ff9900';
$primarynavdesel = '#ffee99';
$secondarynav = '#ff9900';
$graphblankcolour = '#ffee99';
$graphnominalcolour = '#ffaa00';
$graphwarningcolour = "#ff6600";
$graphcriticalcolour = "#ff0000";
$graphalertwarning = 70;
$graphalertcritical = 90;
$bevel = 1;
$bevellight = '#c0c0c0';
$bevelshadow = '#404040';
$bevelmiddle = '#808080';
$thisscript = basename($ENV{'SCRIPT_NAME'});
%alertbox = (
 bgerror => $pagecolour,
 fonterror => '#FF0000',
 texterror => 'error',
 bgok => $pagecolour,
 fontok => '#000000',
 textok => 'ok',
 bgadd => '#009933',
 fontadd => '#FFFFFF',
 textadd => 'add'
);
$pagewidth = 760;
$helpwidth = 125;
$pagewidthlesshelp = $pagewidth - $helpwidth;
$viewsize = 150;

&readhash("${swroot}/main/settings", \%settings);
$language = $settings{'LANGUAGE'};

if ($language =~ /^(\w+)$/) {$language = $1;}
require "${swroot}/langs/base.pl";
require "${swroot}/langs/${language}.pl";
# text for alertboxen is only available in en, so hardcode it for now
require "${swroot}/main/ui/alertboxes.en.pl";

sub showhttpheaders
{
 print "Pragma: no-cache\n";
 print "Cache-control: no-cache\n";
 print "Connection: close\n";
 print "Content-type: text/html\n\n";
}

sub showmenu
{
 $scriptname = $_[0];

 # scriptlist and sectionlist are tied together and are in order
 # with each other
 @scriptlist = ("/cgi-bin/index.cgi", "/cgi-bin/status.cgi", "/cgi-bin/proxy.cgi", "/cgi-bin/portfw.cgi", "/cgi-bin/vpnmain.cgi", "/cgi-bin/logs.cgi/log.dat", "/cgi-bin/ipinfo.cgi", "/cgi-bin/updates.cgi");
 @sectionlist = ( "进入首页", "关于SmoothWall", "服务项目", "网络设置", "虚拟专用网(VPN)", "日志管理", "实用工具", "系统维护" );

 $read = 0;

 print <<END
<table border=0 cellpadding=0 cellspacing=0 cellmargin=0>
<tr>
END
 ;

 while ( $read lt scalar($#sectionlist) + 1 ) {
  if ( $scriptname eq $sectionlist[$read] ) {
   $tabcolour = $primarynavsel;
  } else {
   $tabcolour = $primarynavdesel;
  }
  $sectionname = $sectionlist[$read];
  $scriptlink = $scriptlist[$read];
  print <<END
 <td width=7><img src="/ui/assets/3.5/img/null.gif" width="7" height="1" alt="&nbsp;"></td>

 <td bgcolor="$tabcolour" align="center"><img
 src="/ui/assets/3.5/img/null.gif" width="50" height="3" alt=""><br>&nbsp; <a href="$scriptlink">$sectionname</a> &nbsp;<br><img src="/ui/assets/3.5/img/null.gif" width="50" height="3" alt=""></td>
END
  ;
  $read = $read + 1;
 }

 print <<END
</tr></table>
END
 ;

}

sub subsectionstart
{
 print <<END
<tr><td colspan="2">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align="left" bgcolor="$secondarynav" colspan="2">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
END
 ;
}

sub subsectionend
{
 print <<END
</table>
<img src="/ui/assets/3.5/img/null.gif" width="50" height="5" alt=""></td>
<tr><td valign="top" align="left"><img
 src="/ui/assets/3.5/img/nav.fadedown.gif" width="$pagewidthlesshelp"
 height="20" alt=""></td>
<td width="$helpwidth" bgcolor="#FF9900" align="center" valign="middle">&nbsp;
<a href="/cgi-bin/shutdown.cgi">$tr{'ssshutdown'}</a>
<FONT COLOR='$secondarynavdesel'>|</FONT>
<a href="javascript:displayHelp('$thisscript');"
 title="This will popup a new window with the requested help file">帮助</a> <img
 src="/ui/assets/3.5/img/help.gif" alt="">&nbsp;
</td>
</table>
END
 ;
}

sub subsectiontab
{
 $href = $_[0];
 $linktext = $_[1];
 $end = $_[2];
 $scriptname = $ENV{'SCRIPT_NAME'};

 $basehref = $href;
 $basehref =~ s/\?.*$//g;

 if ($scriptname eq $basehref) {
  $startlink="<STRONG><FONT COLOR='#EEEEEE'>";
  $endlink="</FONT></STRONG>"; }
 else {
  $startlink="<A HREF='$href'>";
  $endlink="</A>"; }

 $thislink = $startlink . $linktext . $endlink;

 print <<END
<td align="left" bgcolor="$secondarynav"><img
 src="/ui/assets/3.5/img/null.gif" width="50" height="5" alt=""><br>&nbsp;&nbsp;
$thislink&nbsp;&nbsp;
END
 ;

 if ($end eq '0') {
  print " <FONT COLOR='$secondarynavdesel'>|</FONT> "; }

 print <<END
</td>
END
 ;

sub showcontrolsection
{
        &subsectionstart();
 &subsectiontab('/cgi-bin/index.cgi', $tr{'sshome'}, 0);
        &subsectiontab('/cgi-bin/credits.cgi', $tr{'sscredits'}, 1);
        &subsectionend();
}

sub showaboutsection
{
 &subsectionstart();
 &subsectiontab('/cgi-bin/status.cgi', $tr{'ssstatus'}, 0);
 &subsectiontab('/cgi-bin/advstatus.cgi', $tr{'ssadvstatus'}, 0);
        &subsectiontab('/cgi-bin/graphs.cgi', $tr{'sstraffic graphs'}, 1);
 &subsectionend();
}

sub showservicessection
{
 &subsectionstart();
 &subsectiontab('/cgi-bin/proxy.cgi', $tr{'ssweb proxy'}, 0);
 &subsectiontab('/cgi-bin/dhcp.cgi', $tr{'ssdhcp'}, 0);
 &subsectiontab('/cgi-bin/ddns.cgi', $tr{'ssdynamic dns'}, 0);
 &subsectiontab('/cgi-bin/ids.cgi', $tr{'ssids'}, 0);
 &subsectiontab('/cgi-bin/remote.cgi', $tr{'ssremote access'}, 0);
 &subsectiontab('/cgi-bin/time.cgi', $tr{'sstime'}, 1);
 &subsectionend();
}

sub shownetworkingsection
{
 &subsectionstart();
 &subsectiontab('/cgi-bin/portfw.cgi', $tr{'ssport forwarding'}, 0);
 &subsectiontab('/cgi-bin/xtaccess.cgi', $tr{'ssexternal service access'}, 0);
 &subsectiontab('/cgi-bin/dmzholes.cgi', $tr{'ssdmz pinholes'}, 0);
 &subsectiontab('/cgi-bin/pppsetup.cgi', $tr{'ssppp settings'}, 0);
 &subsectiontab('/cgi-bin/ipblock.cgi', $tr{'ssip block'}, 0);
 &subsectiontab('/cgi-bin/advnet.cgi', $tr{'ssadvanced'}, 1);
 &subsectionend();
}

sub showvpnsection
{
 &subsectionstart();
 &subsectiontab('/cgi-bin/vpnmain.cgi', $tr{'sscontrol'}, 0);
 &subsectiontab('/cgi-bin/vpn.cgi/vpnconfig.dat', $tr{'ssconnections'}, 1);
 &subsectionend();
}

sub showlogssection
{
 &subsectionstart();
 &subsectiontab('/cgi-bin/logs.cgi/log.dat', $tr{'ssother'}, 0);
 &subsectiontab('/cgi-bin/logs.cgi/proxylog.dat', $tr{'ssweb proxy'}, 0);
 &subsectiontab('/cgi-bin/logs.cgi/firewalllog.dat', $tr{'ssfirewall'}, 0);
 &subsectiontab('/cgi-bin/logs.cgi/ids.dat', $tr{'ssids'}, 1);
 &subsectionend();
}

sub showshutdownsection
{
 &subsectionstart();
 &subsectiontab('','&nbsp;',1);
 &subsectionend();
}

sub showtoolssection
{
 &subsectionstart();
 &subsectiontab('/cgi-bin/ipinfo.cgi', $tr{'ssip info'}, 0);
 &subsectiontab('/cgi-bin/iptools.cgi', $tr{'ssip tools'}, 0);
 &subsectiontab('/cgi-bin/shell.cgi', $tr{'ssshell'}, 1);
 &subsectionend();
}

sub showmaintenancesection
{
 &subsectionstart();
 &subsectiontab('/cgi-bin/updates.cgi', $tr{'ssupdates'}, 0);
 &subsectiontab('/cgi-bin/modem.cgi', $tr{'ssmodem'}, 0);
 &subsectiontab('/cgi-bin/alcateladslfw.cgi', $tr{'ssusb adsl firmware upload'}, 0);
 &subsectiontab('/cgi-bin/changepw.cgi', $tr{'sspasswords'}, 0);
 &subsectiontab('/cgi-bin/backup.img', $tr{'ssbackup'}, 0);
 &subsectiontab('/cgi-bin/shutdown.cgi', $tr{'ssshutdown'}, 1);
 &subsectionend();
}

sub openpage
{
 $title = $_[0];
 $menu = $_[1];
 $extrahead = $_[2];
 $thissection = $_[3];

 if ($menu == 1) { $colspan = 2; } else { $colspan = 1; }

 print <<END
<HTML>
<HEAD>
$extrahead
<TITLE>$title - SmoothWall Express 网路游侠[www.xijing.org]汉化版</TITLE>
<SCRIPT LANGUAGE='javascript' SRC='/ui/assets/3.5/js/script.js'></SCRIPT>
<LINK HREF='/ui/assets/3.5/css/style.css' REL='STYLESHEET' TYPE='text/css'>
</HEAD>
END
 ;

 if ( $thissection ne "help" ) {
  $currentconnection = &connectedstate();
  $cellwidth = $pagewidth / 2;
  print <<END
<BODY BGCOLOR='$pagecolour' TEXT='#000000' LINK='#000000' VLINK='#000000'>
<DIV ALIGN='CENTER'>
<table width="$pagewidth" border="0" cellpadding="0" cellspacing="0">
<TR HEIGHT='$bevel'>
<TD COLSPAN='2' BGCOLOR='$bevellight'></TD>
</TR>
<tr><td width="$cellwidth" height="30" bgcolor="$boxcolour"><a href="/cgi-bin/credits.cgi"><img
 src="/ui/assets/3.5/img/topleft.logo.${version}.gif"
 border="0" alt="SmoothWall Express 2.0" title="SmoothWall Express 2.0"></td>
<td width="$cellwidth" height="30" align="right" bgcolor="$boxcolour">

<table border='0' cellpadding='0' cellspacing='0'>
<tr><td><img src="/ui/assets/3.5/img/netstatus.label.gif"
 alt="current connection status" title="current connection status"></td>
<td><a href="/cgi-bin/index.cgi"><img
 src="/ui/assets/3.5/img/netstatus-wee.${currentconnection}.gif"
 border="0" alt="$currentconnection" title="$currentconnection"></td></tr>
</table>

</td></tr>
<tr><td bgcolor="#FFCC66" colspan="2">
<img src="/ui/assets/3.5/img/null.gif" width="$pagewidth" height="5" alt=""><br>
END
  ;
  &showmenu($thissection);
  print <<END
</td>
END
  ;
 } else {
  print <<END
<BODY BGCOLOR='$pagecolour' TEXT='#000000' LINK='#000000' VLINK='#000000'
 onLoad="window.focus()">
<DIV ALIGN='CENTER'>


END
  ;
 }

}

sub closepage
{
 $thissection = $_[0];

 # if (-e "${swroot}/red/active") {
 # if ( $ENV{'HTTPS'} eq "on" ) {
 #  $sflogoproto = "https";
 # } else {
 #  $sflogoproto = "http";
 # }
 #  $sflogoimg = $sflogoproto . "://sourceforge.net/sflogo.php?group_id=10366&type=1";
 #} else {
  $sflogoimg = "/ui/assets/3.5/img/sflogo.png";
 #}

 if ( $thissection ne "blank" ) {
  print <<END
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</DIV>
<DIV ALIGN='center'>
<table width='$pagewidth' border=0 cellpadding=0 cellspacing=0 BGCOLOR='$boxcolour'>
<tr><td valign="top" align="left" colspan="5"><img
 src="/ui/assets/3.5/img/nav.fadeup.gif" width="$pagewidth"
 height="20" alt=""></td>
<tr><td width='10' valign='top'><img src='/ui/assets/3.5/img/null.gif' height='1' width='10' alt=''></td>
    <td align='left' colspan='3' valign='middle' nowrap>

<table border=0 cellpadding=0 cellspacing=0>
<tr><td>产品协作伙伴</td>
<td>&nbsp;<a href="http://sf.net/projects/smoothwall/"><img
    src="$sflogoimg" width="44" height="16" border="0" valign="center"
    alt="SourceForge.net"></a></td>
<td>&nbsp;<a href='http://www.usr.com/'><img src='/ui/assets/3.5/img/corp/usr.png' alt='U.S. Robotics' valign='center' width="63" height="15" border='0'></a></td>
<td>&nbsp;<a href='http://www.ftel.co.uk/'><img src='/ui/assets/3.5/img/corp/fuji.gif' alt='Fujitsu' valign='center' width="32" height="15" border='0'></td>
</table>

    </td>
    <td width='10' valign='top'><img src='/ui/assets/3.5/img/null.gif' height='1' width='10' alt=''></td>
<tr><td width='10' valign='top'><img src='/ui/assets/3.5/img/null.gif' height='1' width='10' alt=''></td>
    <td align='left' valign='bottom' nowrap>
    <font >
    express $version $revision $webuirevision<br>
    SmoothWall&trade; 商标属于
    <A HREF='http://www.smoothwall.net/'>SmoothWall Limited 网路游侠 [www.xijing.org] 汉化版</A>.
    </font>
    </td>
    <td >&nbsp;</td>
    <td valign=bottom align=right nowrap>
    <font >

    &copy; 2000 - 2003 <a href='http://smoothwall.org/team/'>SmoothWall开发团队</a><br>
<A HREF='/cgi-bin/credits.cgi'>$tr{'credits'}</A> -
    部分 &copy; <a href='http://smoothwall.org/sources.html'>原作者</a>
    </font>
    </td>
    <td width='10' valign='top'><img src='/ui/assets/3.5/img/null.gif' height='1' width='10' alt=''></td>
<tr><td width='10' valign='top'><img src='/ui/assets/3.5/img/null.gif' height='5' width='10' alt=''></td>
<TR HEIGHT='$bevel'><TD COLSPAN='5' BGCOLOR='$bevelshadow'></TD>
</TR>
</table>

</DIV>
END
  ;
 }

 print <<END
</BODY>
</HTML>
END
 ;
}

sub openbigbox
{
 $width = $_[0];
 $align = $_[1];

 print <<END
<TABLE WIDTH='$width' CELLSPACING='0' CELLPADDING='0' BORDER='0'>
<TR>
<TD BGCOLOR='$bigboxcolour' COLSPAN="3" ALIGN='LEFT' VALIGN='TOP'>&nbsp;</TD>
</TD>
</TR>
<TR>
<TD WIDTH='10' BGCOLOR='$bigboxcolour'>&nbsp;</TD>
<TD BGCOLOR='$bigboxcolour' ALIGN='$align'>
END
 ;
}

sub closebigbox
{
 print <<END
</TD><TD WIDTH='10' BGCOLOR='$bigboxcolour'>&nbsp;</TD></TR>
<TR>
<TD BGCOLOR='$bigboxcolour' COLSPAN="3" ALIGN='LEFT' VALIGN='TOP'>&nbsp;</TD>
</TR>
</TABLE>
END
 ;
}

sub openbox
{
 $width = $_[0];
 $align = $_[1];
 $caption = $_[2];
 $cellcolour = $_[3];
 if ( $cellcolour eq "" ) { $cellcolour = $boxcolour; }

 print <<END
<TABLE WIDTH='$width' CELLSPACING='0' CELLPADDING='0'>
<TR HEIGHT='$bevel'>
<TD WIDTH='100%' BGCOLOR='$bevellight'></TD>
</TR>
<TR>
<TD BGCOLOR='$cellcolour'>
<TABLE WIDTH='100%' CELLPADDING='2'>
<TR><TD ALIGN='$align'>
END
 ;
 if ($caption) { print "<B><DIV >$caption</DIV></B>\n"; }
}

sub closebox
{
 print <<END
</TD></TR>
</TABLE>
</TD>
</TR>
<TR HEIGHT='$bevel'>
<TD BGCOLOR='$bevelshadow'></TD>
</TR>
</TABLE>
<BR>
END
 ;
}

sub alertbox
{
 my $thiserror = $_[0];
 my $additional = $_[1];
 if ( $thiserror ne '' && $additional eq '' ) {
  &pageinfo($alertbox{"texterror"}, "<font >" . $tr{'error messages'} . "</font><br>" . $thiserror);
 } elsif ( $thiserror eq 'add' && $additional eq 'add' && $abouttext{$thisscript . "-additional"} ne '' ) {
  &pageinfo($alertbox{"textadd"}, $abouttext{$thisscript . "-additional"});
 } elsif ( $thiserror eq 'add' && $additional eq 'add' && $abouttext{$thisscript . "-additional"} eq '' ) {
  # deliberately do nothing
 } else {
  &pageinfo($alertbox{"textok"}, $abouttext{$thisscript});
 }
}

sub pageinfo
{
 my $thisalerttype = $_[0];
 my $thisboxmessage = $_[1];
 my $localgraphic;
 if ( $thisalerttype ne "error" ) {
  $localgraphic = $thisscript;
 }  else {
  $localgraphic = "error";
 }
 $localgraphic =~ s/\.cgi//g;
 my $thisbgcolour = $alertbox{"bg" . $thisalerttype};
 my $thisfontcolour = $alertbox{"font" . $thisalerttype};

 print qq|
<table border='0' cellpadding='3' cellspacing='0' width="100%">
<tr><td valign='top' bgcolor='$thisbgcolour' width='100'><img src='/ui/assets/3.6/img/pagetitles/page-$localgraphic.png' width='100'></td>
<td valign='top' align='left' bgcolor='$thisbgcolour'>
<font color='$thisfontcolour'>$thisboxmessage</font>
|;
 print qq|</font></td></tr></table>|;

#  &openbox('100%','LEFT','',$thisbgcolour);
#  print <<END
# <table border='0' cellpadding='3' cellspacing='0'>
# <tr><td valign='top'><img src='/ui/assets/3.5/img/alert-$thisalerttype.gif'></td>
# <td valign='top' align='left'><font color='$thisfontcolour'>
# END
#  ;
#  print $thisboxmessage;
#  print "</font></td></tr></table>";
# &closebox;
}

sub writehash
{
 my $filename = $_[0];
 my $hash = $_[1];
 
 # write cgi vars to the file.
 open(FILE, ">${filename}") or die "Unable to write file $filename";
 flock FILE, 2;
 foreach $var (keys %$hash)
 {
  $val = $hash->{$var};
  if ($val =~ / /) {
   $val = "\'$val\'"; }
  if (!($var =~ /^ACTION/)) {
   print FILE "${var}=${val}\n"; }
 }
 close FILE;
}

sub readhash
{
 my $filename = $_[0];
 my $hash = $_[1];
 my ($var, $val);

 open(FILE, $filename) or die "Unable to read file $filename";
 
 while (<FILE>)
 {
  chop;
  ($var, $val) = split /=/, $_, 2;
  if ($var)
  {
   $val =~ s/^\'//g;
   $val =~ s/\'$//g;
   $hash->{$var} = $val;
  }
 }
 close FILE;
}

sub getcgihash
{
 my $hash = $_[0];
 my $buffer = '';
 my $length = $ENV{'CONTENT_LENGTH'};
 my ($name, $value);
 my ($pair, @pairs, $read);
 my %hash;
 my $boundary;
 my %remotesettings;
 my %main;
 my %netsettings;
 my $redip = '0.0.0.0';
 my $referer;
 my $shorthostname;
 my @hostnameelements;
 
 if ($ENV{'REQUEST_METHOD'} ne 'POST') {
  return; }

 $ENV{'HTTP_REFERER'} =~ m/^(http|https)\:\/\/(.*?)[\:|\/]/;
 $referer = $2;

 &readhash("${swroot}/remote/settings", \%remotesettings);
 &readhash("${swroot}/main/settings", \%main);
 &readhash("${swroot}/ethernet/settings", \%netsettings);

 @hostnameelements = split(/\./, $main{'HOSTNAME'});
 $shorthostname = $hostnameelements[0];

 if (open(FILE, "${swroot}/red/local-ipaddress"))
 {
  $redip = <FILE>; chomp $redip;
  close(FILE);
 }

 if ($remotesettings{'ENABLE_SECURE_ADMIN'} eq 'on')
 {
  unless ($referer eq $main{'HOSTNAME'} ||
   $referer eq $shorthostname ||
   $referer eq $netsettings{'GREEN_ADDRESS'} ||
   $referer eq $redip)
  {
   &log("Referral $ENV{'HTTP_REFERER'} is not a SmoothWall page.");
   return;
  }
 }       
 
 $read = 0;
 $buffer = "";
 while($read < $length){
  $read = $read + (read(STDIN, $buf, 1024) or die "Could not read buffer:$read: $@");
  $buffer .= $buf;
 }
 unless($read == $length) {
  die "Could not read buffer: $!";
 }

 if($ENV{'CONTENT_TYPE'} =~ m/multipart\/form-data; boundary=(.*)/) {
  $boundary = $1;
  chomp $boundary;
  $boundary =~ s/\+/ /g;
  foreach (split(/$boundary/,$buffer)) {
   s!--$!!so;
   if(m/Content-Disposition: form-data; name="(.*?)"/is) {
    $name = $1;
   }
   if(m/Content-Disposition: form-data; name="$name".*?\015\012\015\012(.*)$/is) {
    $value = $1;
    $value =~ s!\015\012$!!so;
    $hash->{$name} = $value;
   }
   else { next; }
  }
 } else {
  @pairs = split(/&/, $buffer);

  foreach $pair (@pairs)
  {
   $pair =~ s/\+/ /g;
   ($name, $value) = split(/=/, $pair);
   next unless $name; # fields MUST BE named!
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack('C', hex($1))/eg;
   $value =~s/[^\w\013\n!@#\$%\^\*()_\-\+=\{\}\[\]\\|;:\'\"<,>\.?\/`~\& ]//g;
   $hash->{$name} = $value;
      }
     }
 return %hash;
}

sub log
{
 system('/usr/bin/logger', '-t', 'smoothwall', $_[0]);
}

sub age
{
 my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
         $atime, $mtime, $ctime, $blksize, $blocks) = stat $_[0];
 my $now = time;

 my $totalsecs = $now - $mtime;
 my $days = int($totalsecs / 86400);
 my $totalhours = int($totalsecs / 3600);
 my $hours = $totalhours % 24;
 my $totalmins = int($totalsecs / 60);
 my $mins = $totalmins % 60;
 my $secs = $totalsecs % 60;

  return "${days}d ${hours}h ${mins}m ${secs}s";
}

sub validip
{
 my $ip = $_[0];

 if (!($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/)) {
  return 0; }
 else
 {
  @octets = ($1, $2, $3, $4);
  foreach $_ (@octets)
  {
   if (/^0./) {
    return 0; }
   if ($_ < 0 || $_ > 255) {
    return 0; }
  }
  return 1;
 }
}

sub validmask
{
 my $mask = $_[0];

 # secord part an ip?
 if (&validip($mask)) {
  return 1; }
 # second part a number?
 if (/^0/) {
  return 0; }
 if (!($mask =~ /^\d+$/)) {
  return 0; }
 if ($mask >= 0 && $mask <= 32) {
  return 1; }
 return 0;
}

sub validipormask
{
 my $ipormask = $_[0];

 # see if it is a IP only.
 if (&validip($ipormask)) {
  return 1; }
 # split it into number and mask.
 if (!($ipormask =~ /^(.*?)\/(.*?)$/)) {
  return 0; }
 $ip = $1;
 $mask = $2;
 # first part not a ip?
 if (!(&validip($ip))) {
  return 0; }
 return &validmask($mask);
}

sub validipandmask
{
 my $ipandmask = $_[0];

 # split it into number and mask.
 if (!($ipandmask =~ /^(.*?)\/(.*?)$/)) {
  return 0; }
 $ip = $1;
 $mask = $2;
 # first part not a ip?
 if (!(&validip($ip))) {
  return 0; }
 return &validmask($mask);
}

sub validport
{
 $_ = $_[0];

 if (!/^\d+$/) {
  return 0; }
 if (/^0./) {
  return 0; }
 if ($_ >= 1 && $_ <= 65535) {
  return 1; }
 return 0;
}

sub validportrange
{
        my $ports = $_[0];
        my $left; my $right;   

        if (&validport($ports)) {
                return 1; }
        if ($ports =~ /:/)
        {
                $left = $`;
                $right = $';
                if (&validport($left) && &validport($right))
                {
                        if ($right > $left) {
                                return 1; }
                }
        }
        return 0;
}

sub validmac
{
 $_ = $_[0];

 if (/^[0-9a-fA-F]{2}[\:\-][0-9a-fA-F]{2}[\:\-][0-9a-fA-F]{2}[\:\-][0-9a-fA-F]{2}[\:\-][0-9a-fA-F]{2}[\:\-][0-9a-fA-F]{2}$/) {
  return 1; }
 return 0;
}

sub basename {
 my ($filename) = @_;
 $filename =~ m!.*/(.*)!;
 if ($1) {
  return $1;
 } else {
  return $filename;
 }
}

sub connectedstate {
 my $theconnstate;
 if ( -e "${swroot}/red/active" ) {
  $theconnstate = "connected";
 } elsif ( -e "/var/run/ppp-smooth.pid" ) {
  $theconnstate = "connecting";
 } else {
  $theconnstate = "idle";
 }
 return $theconnstate;
}


1;

  评论这张
 
阅读(1238)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017