이 작은 스크립트를 IPv4에서 IPv6로 어떻게 조정합니까?

이 작은 스크립트를 IPv4에서 IPv6로 어떻게 조정합니까?

누가 전화선을 두드리고 있는지 확인하고, whois를 통해 전화선을 두드리고 싶은 사람의 주소를 표시하는 스크립트입니다.

awk '{

    for (i = 1; i <= NF; i++)

      if ($i ~ /^SRC=/)
          print substr($i, 5)

}' /var/log/syslog | sort -u | while read ip; #former file was: /etc/sysconfig/syslog

do
    printf ' INVALID STATE ' && printf ' === %s ===\n' "$ip"
    whois "$ip" >> output-001.txt;
done

이 스크립트는 IPv4 주소에서는 작동하지만 IPv6에서는 작동하지 않습니다. 두 주소 모두에서 작동하도록 어떻게 조정해야 합니까? 전화선에 연락하려는 모든 사람의 whois 주소가 필요합니다.

내용은 output-001.txt다음과 같습니다:

알 수 없는 AS 번호 또는 알 수 없는 IP 네트워크입니다. 이 프로그램(whois)을 업그레이드하십시오.

공급자의 방화벽에 의해 스크립트가 차단되었기 때문인 것 같습니다. 공급자(unitymedia)의 방화벽을 통과하려면 무엇을 추가할 수 있나요?

roaima의 경우 2016년 여름 결과는 output-001.txt에 다음과 같습니다.

% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf

% Note: this output has been filtered.
%       To receive output for a database update, use the "-B" flag.

% Information related to '2a02:908::/32'

% Abuse contact for '2a02:908::/32' is '[email protected]'

inet6num:       2a02:908::/32
netname:        DE-KNRW-20090121
country:        DE
org:            ORG-iGCK3-RIPE
admin-c:        UMAC-RIPE
tech-c:         UMTC-RIPE
status:         ALLOCATED-BY-RIR
mnt-by:         RIPE-NCC-HM-MNT
mnt-lower:      UNITYMEDIA-MNT
mnt-routes:     UNITYMEDIA-MNT
mnt-domains:    UNITYMEDIA-MNT
created:        2009-01-21T09:36:59Z
last-modified:  2016-04-14T09:45:51Z
source:         RIPE # Filtered
remarks:        Contact data for any network abuse/spam/security issue:
remarks:        [email protected]
remarks:        =======================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax:  49 2273 5947 3220 (primary)
remarks:        Fax:  49 2273 5947 2251 (backup)

organisation:   ORG-iGCK3-RIPE
org-name:       Unitymedia NRW GmbH
org-type:       LIR
address:        Aachener Str. 746 - 750
address:        50933
address:        Koeln
address:        GERMANY
phone:          +49 2273 605 8567
fax-no:         +49 2273 5947 2251
fax-no:         +49 2273 605 4339
abuse-mailbox:  [email protected]
admin-c:        SB666-RIPE
admin-c:        JK8125-RIPE
admin-c:        MH3982-RIPE
mnt-ref:        RIPE-NCC-HM-MNT
mnt-ref:        UNITYMEDIA-MNT
mnt-by:         RIPE-NCC-HM-MNT
abuse-c:        UKAD1-RIPE
created:        2004-04-17T11:09:24Z
last-modified:  2016-03-11T12:07:57Z
source:         RIPE # Filtered

role:           Unitymedia Administration
address:        Unitymedia Group
                Aachener Strasse 746-750
                50933 Koeln
                Germany
admin-c:        EM572-RIPE
tech-c:         UMTC-RIPE
nic-hdl:        UMAC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2009-09-03T09:14:51Z
source:         RIPE # Filtered

role:           Unitymedia Technical Contact
address:        Unitymedia KabelBW GmbH
address:        Michael-Schumacher-Strasse 1
address:        50170 Kerpen
address:        DE
admin-c:        UMAC-RIPE
tech-c:         MH3982-RIPE
tech-c:         SJ3189-RIPE
tech-c:         EM10466-RIPE
nic-hdl:        UMTC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2014-11-19T06:01:06Z
source:         RIPE # Filtered

% Information related to '2a02:908:8000::/33AS20825'

route6:         2a02:908:8000::/33
descr:          Unitymedia
origin:         AS20825
mnt-by:         UNITYMEDIA-MNT
created:        2016-02-11T13:24:04Z
last-modified:  2016-02-11T13:25:00Z
source:         RIPE

% Information related to '2a02:908:8000::/33AS6830'

route6:         2a02:908:8000::/33
descr:          Unitymedia
origin:         AS6830
mnt-by:         UNITYMEDIA-MNT
created:        2016-02-11T14:58:12Z
last-modified:  2016-02-11T14:58:12Z
source:         RIPE

% This query was served by the RIPE Database Query Service version 1.87.4 (BLAARKOP)


% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf

% Note: this output has been filtered.
%       To receive output for a database update, use the "-B" flag.

% Information related to '2a02:908::/32'

% Abuse contact for '2a02:908::/32' is '[email protected]'

inet6num:       2a02:908::/32
netname:        DE-KNRW-20090121
country:        DE
org:            ORG-iGCK3-RIPE
admin-c:        UMAC-RIPE
tech-c:         UMTC-RIPE
status:         ALLOCATED-BY-RIR
mnt-by:         RIPE-NCC-HM-MNT
mnt-lower:      UNITYMEDIA-MNT
mnt-routes:     UNITYMEDIA-MNT
mnt-domains:    UNITYMEDIA-MNT
created:        2009-01-21T09:36:59Z
last-modified:  2016-04-14T09:45:51Z
source:         RIPE # Filtered
remarks:        Contact data for any network abuse/spam/security issue:
remarks:        [email protected]
remarks:        =======================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax:  49 2273 5947 3220 (primary)
remarks:        Fax:  49 2273 5947 2251 (backup)

organisation:   ORG-iGCK3-RIPE
org-name:       Unitymedia NRW GmbH
org-type:       LIR
address:        Aachener Str. 746 - 750
address:        50933
address:        Koeln
address:        GERMANY
phone:          +49 2273 605 8567
fax-no:         +49 2273 5947 2251
fax-no:         +49 2273 605 4339
abuse-mailbox:  [email protected]
admin-c:        SB666-RIPE
admin-c:        JK8125-RIPE
admin-c:        MH3982-RIPE
mnt-ref:        RIPE-NCC-HM-MNT
mnt-ref:        UNITYMEDIA-MNT
mnt-by:         RIPE-NCC-HM-MNT
abuse-c:        UKAD1-RIPE
created:        2004-04-17T11:09:24Z
last-modified:  2016-03-11T12:07:57Z
source:         RIPE # Filtered

role:           Unitymedia Administration
address:        Unitymedia Group
                Aachener Strasse 746-750
                50933 Koeln
                Germany
admin-c:        EM572-RIPE
tech-c:         UMTC-RIPE
nic-hdl:        UMAC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2009-09-03T09:14:51Z
source:         RIPE # Filtered

role:           Unitymedia Technical Contact
address:        Unitymedia KabelBW GmbH
address:        Michael-Schumacher-Strasse 1
address:        50170 Kerpen
address:        DE
admin-c:        UMAC-RIPE
tech-c:         MH3982-RIPE
tech-c:         SJ3189-RIPE
tech-c:         EM10466-RIPE
nic-hdl:        UMTC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2014-11-19T06:01:06Z
source:         RIPE # Filtered

% Information related to '2a02:908:8000::/33AS20825'

route6:         2a02:908:8000::/33
descr:          Unitymedia
origin:         AS20825
mnt-by:         UNITYMEDIA-MNT
created:        2016-02-11T13:24:04Z
last-modified:  2016-02-11T13:25:00Z
source:         RIPE

% Information related to '2a02:908:8000::/33AS6830'

route6:         2a02:908:8000::/33
descr:          Unitymedia
origin:         AS6830
mnt-by:         UNITYMEDIA-MNT
created:        2016-02-11T14:58:12Z
last-modified:  2016-02-11T14:58:12Z
source:         RIPE

% This query was served by the RIPE Database Query Service version 1.87.4 (ANGUS)


Unbekannte AS-Nummer oder unbekanntes IP-Netzwerk. Bitte führen Sie ein Upgrade dieses Programms durch.
% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf

% Note: this output has been filtered.
%       To receive output for a database update, use the "-B" flag.

% Information related to '2a02:908::/32'

% Abuse contact for '2a02:908::/32' is '[email protected]'

inet6num:       2a02:908::/32
netname:        DE-KNRW-20090121
country:        DE
org:            ORG-iGCK3-RIPE
admin-c:        UMAC-RIPE
tech-c:         UMTC-RIPE
status:         ALLOCATED-BY-RIR
mnt-by:         RIPE-NCC-HM-MNT
mnt-lower:      UNITYMEDIA-MNT
mnt-routes:     UNITYMEDIA-MNT
mnt-domains:    UNITYMEDIA-MNT
created:        2009-01-21T09:36:59Z
last-modified:  2016-04-14T09:45:51Z
source:         RIPE # Filtered
remarks:        Contact data for any network abuse/spam/security issue:
remarks:        [email protected]
remarks:        =======================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax:  49 2273 5947 3220 (primary)
remarks:        Fax:  49 2273 5947 2251 (backup)

organisation:   ORG-iGCK3-RIPE
org-name:       Unitymedia NRW GmbH
org-type:       LIR
address:        Aachener Str. 746 - 750
address:        50933
address:        Koeln
address:        GERMANY
phone:          +49 2273 605 8567
fax-no:         +49 2273 5947 2251
fax-no:         +49 2273 605 4339
abuse-mailbox:  [email protected]
admin-c:        SB666-RIPE
admin-c:        JK8125-RIPE
admin-c:        MH3982-RIPE
mnt-ref:        RIPE-NCC-HM-MNT
mnt-ref:        UNITYMEDIA-MNT
mnt-by:         RIPE-NCC-HM-MNT
abuse-c:        UKAD1-RIPE
created:        2004-04-17T11:09:24Z
last-modified:  2016-03-11T12:07:57Z
source:         RIPE # Filtered

role:           Unitymedia Administration
address:        Unitymedia Group
                Aachener Strasse 746-750
                50933 Koeln
                Germany
admin-c:        EM572-RIPE
tech-c:         UMTC-RIPE
nic-hdl:        UMAC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2009-09-03T09:14:51Z
source:         RIPE # Filtered

role:           Unitymedia Technical Contact
address:        Unitymedia KabelBW GmbH
address:        Michael-Schumacher-Strasse 1
address:        50170 Kerpen
address:        DE
admin-c:        UMAC-RIPE
tech-c:         MH3982-RIPE
tech-c:         SJ3189-RIPE
tech-c:         EM10466-RIPE
nic-hdl:        UMTC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2014-11-19T06:01:06Z
source:         RIPE # Filtered

% Information related to '2a02:908:8000::/33AS20825'

답변1

출력 파일의 첫 번째 IPv6 주소를 사용하면

$whois 2a02:908::/32 

예상한 결과를 얻었습니다. whois 오류는 없습니다(알 수 없는 AS 번호 또는 알 수 없는 IP 네트워크입니다. 이 프로그램(whois)을 업그레이드하십시오.)

$whois 2a02:908::/32
% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf

% Note: this output has been filtered.
%       To receive output for a database update, use the "-B" flag.

% Information related to '2a02:908::/32'

% Abuse contact for '2a02:908::/32' is '[email protected]'

inet6num:       2a02:908::/32
netname:        DE-KNRW-20090121
country:        DE
org:            ORG-iGCK3-RIPE
admin-c:        UMAC-RIPE
tech-c:         UMTC-RIPE
status:         ALLOCATED-BY-RIR
remarks:        Contact data for any network abuse/spam/security issue:
remarks:        [email protected]
remarks:        =======================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: 49 2273 5947 3220 (primary)
remarks:        Fax: 49 2273 5947 2251 (backup)
mnt-by:         RIPE-NCC-HM-MNT
mnt-by:         UNITYMEDIA-MNT
mnt-lower:      UNITYMEDIA-MNT
mnt-routes:     UNITYMEDIA-MNT
mnt-domains:    UNITYMEDIA-MNT
created:        2009-01-21T09:36:59Z
last-modified:  2016-08-25T14:02:54Z
source:         RIPE # Filtered

organisation:   ORG-iGCK3-RIPE
org-name:       Unitymedia NRW GmbH
org-type:       LIR
address:        Aachener Str. 746 - 750
address:        50933
address:        Koeln
address:        GERMANY
phone:          +49 2273 605 8567
fax-no:         +49 2273 5947 2251
fax-no:         +49 2273 605 4339
admin-c:        SB666-RIPE
admin-c:        JK8125-RIPE
admin-c:        MH3982-RIPE
abuse-c:        UKAD1-RIPE
mnt-ref:        RIPE-NCC-HM-MNT
mnt-ref:        UNITYMEDIA-MNT
abuse-mailbox:  [email protected]
mnt-by:         RIPE-NCC-HM-MNT
mnt-by:         UNITYMEDIA-MNT
created:        2004-04-17T11:09:24Z
last-modified:  2016-08-25T14:03:26Z
source:         RIPE # Filtered

role:           Unitymedia Administration
address:        Unitymedia Group
                Aachener Strasse 746-750
                50933 Koeln
                Germany
admin-c:        EM572-RIPE
tech-c:         UMTC-RIPE
nic-hdl:        UMAC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2009-09-03T09:14:51Z
source:         RIPE # Filtered

role:           Unitymedia Technical Contact
address:        Unitymedia KabelBW GmbH
address:        Michael-Schumacher-Strasse 1
address:        50170 Kerpen
address:        DE
admin-c:        UMAC-RIPE
tech-c:         MH3982-RIPE
tech-c:         SJ3189-RIPE
tech-c:         EM10466-RIPE
nic-hdl:        UMTC-RIPE
remarks:        =====================================================
remarks:        Contact data for any legal/law enforcement inquiries:
remarks:        Auskunft.UM (at) unitymedia.de
remarks:        Fax: +49 2273 5947 3220 (primary)
remarks:        Fax: +49 2273 5947 2251 (backup)
remarks:        =====================================================
abuse-mailbox:  [email protected]
mnt-by:         UNITYMEDIA-MNT
created:        2009-07-10T11:13:10Z
last-modified:  2014-11-19T06:01:06Z
source:         RIPE # Filtered

% Information related to '2a02:908::/32AS20825'

route6:         2a02:908::/32
descr:          Unitymedia
origin:         AS20825
mnt-by:         UNITYMEDIA-MNT
created:        2009-01-23T22:05:02Z
last-modified:  2009-07-10T15:01:59Z
source:         RIPE

% Information related to '2a02:908::/32AS6830'

route6:         2a02:908::/32
descr:          Unitymedia
origin:         AS6830
mnt-by:         UNITYMEDIA-MNT
created:        2016-02-11T14:56:17Z
last-modified:  2016-02-11T14:56:17Z
source:         RIPE

% This query was served by the RIPE Database Query Service version 1.88 (BLAARKOP)

이 메시지는 whois 프로그램을 업데이트하라는 메시지를 표시합니다.
최근에 whois 프로그램을 업데이트/업그레이드해 보셨나요?

관련 정보