Openwrt-NetKeeper icon indicating copy to clipboard operation
Openwrt-NetKeeper copied to clipboard

[bug report]pppoe.log格式不一致

Open kuri-leo opened this issue 7 years ago • 34 comments

路由器: WNDR 3800 OS: LEDE LEDE Reboot 17.01.0-rc2 rp-pppoe-server 版本: 3.12-1 地点: CQUPT

根据issue #136 提供的新方法,测试无法成功,然后看了一下,似乎是pppoe.log的格式不对 我这边的格式为:

Plugin /etc/ppp/plugins/rp-pppoe.so loaded.
RP-PPPoE plugin version 3.8p compiled against pppd 2.4.7
Connected to xx:xx:xx:xx:xx:xx via interface br-lan
Using interface ppp1
Connect: ppp1 <--> br-lan
no PAP secret found for ^M1=WA<- c1xxxxxxxxxxx@cqupt
PAP peer authentication failed for ^M1=WA<- c1xxxxxxxxxxx@cqupt
Connection terminated.

但根据nk4脚本,应该是包含network.wan.usernamenetwork.wan.password字段才对。。。

所以似乎脚本并不能通用Orz

kuri-leo avatar Jun 03 '17 05:06 kuri-leo

@gmfghp 密码的话就是原始密码吧?不过账号是不是不能显示转义字符啊,我看pppoe.log里面并没有转义支付

kuri-leo avatar Jun 03 '17 07:06 kuri-leo

同样遇到了这种问题

colorlight avatar Jun 05 '17 01:06 colorlight

同问,用此方法没法成功。。。

lijinwill avatar Jun 05 '17 06:06 lijinwill

@colorlight @lijinwill 目前来看,这个和路由器的CPU有关

我的思路是,用grep抓@cqupt可以把no PAP secret found for ^M1=WA<- c1xxxxxxxxxxx@cquptPAP peer authentication failed for ^M1=WA<- c1xxxxxxxxxxx@cqupt抓出来,然后用dos2unix转码得到真实账号

然而,目前的问题是

  1. grep得到的内容存不进变量。。。(不会shell编程)
  2. 似乎LEDE上没有dos2unix

所以目前仍然是无解状态。。。

kuri-leo avatar Jun 05 '17 08:06 kuri-leo

这个功能脚本里已经实现了啊,问题是,还是这种情况 username=$(grep "No CHAP secret found for authenticating" /tmp/pppoe.log | tail -n 1 | cut -b 43-) uci set network.netkeeper.username="\r$username"

colorlight avatar Jun 05 '17 08:06 colorlight

我9331的没有问题 可以用

Destinyzxn avatar Jun 05 '17 10:06 Destinyzxn

@gmfghp 密码不行

Destinyzxn avatar Jun 05 '17 10:06 Destinyzxn

@colorlight 之前没这个…只有grep network.wan.username的

@gmfghp 他之前的密码也是从pppoe.log中读取的,似乎密码也被加密了?

kuri-leo avatar Jun 05 '17 12:06 kuri-leo

@gmfghp 你用3.11的那个脚本 只获取账号那个 就可以

Destinyzxn avatar Jun 05 '17 12:06 Destinyzxn

虽然不能获取密码 但是也够了 @gmfghp

Destinyzxn avatar Jun 05 '17 12:06 Destinyzxn

我k2也不能获取到密码 就算是 原版lede openwrt 安装的是3.12 也不行

Destinyzxn avatar Jun 05 '17 12:06 Destinyzxn

@Destinyzxn 如果他那个算法没有修改密码,讲道理把 nk4.sh 中的 uci set network.netkeeper.password="$(grep "network.wan.password" /tmp/pppoe.log | tail -n 1 | cut -b 64-)"改成你的密码就能行了

kuri-leo avatar Jun 05 '17 13:06 kuri-leo

哎呀 无所谓啦 反正手动输入也不麻烦 不存在的

Destinyzxn avatar Jun 05 '17 13:06 Destinyzxn

@gmfghp 然而并没有这种操作。。。

我猜的,在mtk下的rp-pppoe-server会记录下network.wan.usernamenetwork.wan.password两个字段,然后nk4.sh通过分别对log进行grep来获取真实username和password

所以,不需要你说的那个操作,直接在nk4.sh 的基础上改一下,把 uci set network.netkeeper.password="$(grep "network.wan.password" /tmp/pppoe.log | tail -n 1 | cut -b 64-)"改成uci set network.netkeeper.password="你的密码"就可以了

当然,这是在密码不变的前提上。。。

kuri-leo avatar Jun 05 '17 13:06 kuri-leo

然而每个月都要换一次动态密码的

Destinyzxn avatar Jun 05 '17 14:06 Destinyzxn

@Destinyzxn 就用静态密码呀。。。我用了一年多都没出问题

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

我学校有心跳 只能动态密码 @kuri-leo

Destinyzxn avatar Jun 05 '17 14:06 Destinyzxn

@Destinyzxn 节哀顺变23333

~~其实你们可以去工信部举报,传说弱校当年就是这样把心跳干掉的~~

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

怕是没这么简单哟 @kuri-leo

Destinyzxn avatar Jun 05 '17 14:06 Destinyzxn

3.12版本是在哪获取的

colorlight avatar Jun 05 '17 14:06 colorlight

@gmfghp 对啊,我说的改不是改pppoe.log,而是把nk4.sh的代码改了

  1. username=$(grep "network.wan.username" /tmp/pppoe.log | tail -n 1 | cut -b 66-)改成username=$(grep "No CHAP secret found for authenticating" /tmp/pppoe.log | tail -n 1 | cut -b 43-) (感谢@colorlight 提供)
  2. uci set network.netkeeper.password="$(grep "network.wan.password" /tmp/pppoe.log | tail -n 1 | cut -b 64-)"改成uci set network.netkeeper.password="你的密码" (我猜的,不知道行不行)

改完最好重新部署一次试试

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

不行,我试过了

colorlight avatar Jun 05 '17 14:06 colorlight

@colorlight 我的是LEDE Reboot 17.01.0-rc2,直接opkg install就可以

你如果没有的话可以去找一下OpenWrt的14版本的包试一试

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

@colorlight 我之前遇到的问题是 grep 获得的字符串无法赋值给变量。。。不知道是不是同样的问题

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

@Destinyzxn 先给10000打电话投诉,就说频繁掉线,然后客服一般会打哈哈,然后你就去工信部网站投诉。。。

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

@gmfghp 我说的就是这个意思,改了的代码应该是这样的:

#!/bin/sh
#启动pppoe服务器。TODO:检测是否有pppoe服务器进程,再启动
sleep 1
pppoe-server -k -I br-lan

#删掉之前的log,加快读取速度
rm /tmp/pppoe.log

while :
do
#读取log最后一个账号
    username=$(grep "No CHAP secret found for authenticating" /tmp/pppoe.log | tail -n 1 | cut -b 43-)

    if [ "$username" != "$username_old" ]
    then
        ifdown netkeeper
        uci set network.netkeeper.username="\r$username"
        uci set network.netkeeper.password="你的密码"
        uci commit
        ifup netkeeper
        username_old="$username"
        echo "new username $username"
    fi
#    echo "wait"
    sleep 10

done

然而,我遇到的问题是$(grep "No CHAP secret found for authenticating" /tmp/pppoe.log | tail -n 1 | cut -b 43-)的值根本没法存到username里面去

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

@gmfghp 我用的是3.12的。。。没仔细看,反正就是这个意思

另外,我建议是grep @CQUPT,来抓取账号,直接回避版本问题。。。~~当然,如果你用的手机号做账号当我啥都没说。。。~~

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

@gmfghp 我试过,直接grep "@cqupt"就可以,然后会返回两行字符串

no PAP secret found for ^M1=WA<- c1xxxxxxxxxxx@cqupt
PAP peer authentication failed for ^M1=WA<- c1xxxxxxxxxxx@cqupt

kuri-leo avatar Jun 05 '17 14:06 kuri-leo

@kuri-leo 你解决这个问题了吗?? `RP-PPPoE plugin version 3.8p compiled against pppd 2.4.7

Plugin /etc/ppp/plugins/rp-pppoe.so loaded.

RP-PPPoE plugin version 3.8p compiled against pppd 2.4.7

Connected to 00:e0:4c:36:09:14 via interface br-lan

Using interface ppp0

Connect: ppp0 <--> br-lan

PPP session is 23377

Connected to 74:5a:aa:c0:da:f3 via interface eth0.2

Using interface pppoe-netkeeper

Connect: pppoe-netkeeper <--> eth0.2

no PAP secret found for ^M1#V2Z(A3a15310287720@cqupt

PAP peer authentication failed for ^M1#V2Z(A3a15310287720@cqupt

Terminating on signal 15

Modem hangup

Connection terminated.

Remote message: Username does not exist.##Username does not exist.

PAP authentication failed

Modem hangup

Connection terminated.

Sent PADT`

lijinwill avatar Jun 05 '17 14:06 lijinwill

@lijinwill 这个应该是pppoe.log吧,有个大概的思路,~~等过几天有空我试试吧~~

kuri-leo avatar Jun 05 '17 15:06 kuri-leo