Program Club

cntlm 구성 파일에 프록시 정보를 입력하는 방법은 무엇입니까?

proclub 2020. 10. 13. 19:35
반응형

cntlm 구성 파일에 프록시 정보를 입력하는 방법은 무엇입니까?


Cntlm 은 NTLM / NTLM 세션 응답 / NTLMv2 인증 HTTP 프록시로서 Microsoft 독점 세계의 사슬에서 벗어날 수 있도록 도와줍니다.

다음 형식의 프록시 URL이 있습니다.

http://user:passwords@my_proxy_server.com:80

그리고이 정보를에 제공해야합니다 cntlm. 구성 파일 cntlm.ini에는 다음과 같은 구조와 매개 변수가 있습니다.

Username 
Domain
Password    
Proxy   

이 네 가지 옵션을 채우기 위해 원래 프록시 속성을 어떻게 나눌 지 잘 모르겠습니다.


에서 사용자, 도메인 및 프록시 정보를 업데이트 cntlm.ini한 다음 다음 명령을 사용하여 프록시를 테스트합니다 (Cntlm 설치 폴더에서 실행).

cntlm -c cntlm.ini -I -M http://google.ro

비밀번호를 묻고 필요한 인증 정보를 인쇄합니다. cntlm.ini

샘플 cntlm.ini:

Username            user
Domain              domain

# provide actual value if autodetection fails
# Workstation         pc-name

Proxy               my_proxy_server.com:80
NoProxy             127.0.0.*, 192.168.*

Listen              127.0.0.1:54321
Listen              192.168.1.42:8080
Gateway             no

SOCKS5Proxy         5000
# provide socks auth info if you want it
# SOCKS5User          socks-user:socks-password

# printed authentication info from the previous step
Auth            NTLMv2
PassNTLMv2      98D6986BCFA9886E41698C1686B58A09

참고 : Linux에서 구성 파일은cntlm.conf


솔루션은 두 단계를 거쳐야합니다!

먼저에서 사용자, 도메인 및 프록시 필드를 완료합니다 cntlm.ini. 사용자 이름과 도메인은 사무실에서 Windows에 로그인하는 데 사용하는 모든 것이어야합니다.

Username            employee1730
Domain              corporate
Proxy               proxy.infosys.corp:8080

그런 다음 다음과 같은 명령을 사용하여 cntlm을 테스트합니다.

cntlm.exe -c cntlm.ini -I -M http://www.bbc.co.uk

비밀번호를 묻습니다 (Windows_에 로그인 할 때 사용하는 모든 항목). 바라건대 어딘가에 'http 200 ok'를 인쇄하고 몇 가지 비밀 토큰 인증 정보를 인쇄합니다. 이제 추가 이것들을 하는 cntlm.ini, 예를 :

Auth            NTLM
PassNT          A2A7104B1CE00000000000000007E1E1
PassLM          C66000000000000000000000008060C8

마지막으로 http_proxyWindows 에서 환경 변수를 다음과 같이 Listen설정합니다 (기본적으로 설정되어 있는 필드를 변경하지 않았다고 가정 3128).

http://localhost:3128

http://forum.kde.org/viewtopic.php?f=83&t=119352

내 자신의 스레드가 있습니다. 나는 거기에 분명히 보여 주었다.

나는 거기에서 아무것도 변경할 수 없으며 더 이상 내 계정에 액세스 할 수 없습니다. idk 이유는 있지만 cntlm.conf 파일에 모든 것을 설정하면 (암호는 필요하지 않습니다) 파일을 저장하고 torminal로 이동하십시오. 유형 명령 :

cntlm -H

프록시 암호를 입력하십시오. 그러면 3 줄의 해시가 출력됩니다. 모든 해시를 복사하여 "password"줄 대신 cntlm.conf 파일에 붙여 넣습니다.

따라서 암호가 암호화되고 사용자는 ettercap을 사용하여 찾을 수 없습니다.)


구성없이 간단히 다음 명령을 실행할 수 있습니다 ( 사용자 정보 수정 myusername수정 mydomain).

cntlm -u myusername -d mydomain -H

또는

cntlm -u myusername@mydomain -H

의 암호를 묻고 myusername다음과 같은 출력을 제공합니다.

PassLM          1AD35398BE6565DDB5C4EF70C0593492
PassNT          77B9081511704EE852F94227CF48A793
PassNTLMv2      A8FC9092D566461E6BEA971931EF1AEC    # Only for user 'myusername', domain 'mydomain'

그런 다음 파일을 생성 cntlm.ini(또는 cntlm.conf(당신의 교체 다음과 같은 내용으로 기본 경로를 사용하여 Linux에) myusername, mydomain그리고 A8FC9092D566461E6BEA971931EF1AEC정보 및 이전 명령의 결과를 함께) :

Username    myusername
Domain      mydomain

Proxy       my_proxy_server.com:80
NoProxy     127.0.0.*, 192.168.*

Listen      127.0.0.1:5865
Gateway     yes

SOCKS5Proxy 5866

Auth        NTLMv2
PassNTLMv2  A8FC9092D566461E6BEA971931EF1AEC

그러면 로컬 포트에 로컬 오픈 프록시가 있고 로컬 포트에 5865SOCKS5 프로토콜을 이해하는 다른 프록시가 있습니다 5866.


다음은 cntlm 사용 방법에 대한 가이드입니다.

cntlm이란 무엇입니까?

cntlm은 NTLM / NTLMv2 인증 HTTP 프록시입니다.

프록시의 주소를 받아 청취 소켓을 열어 각 요청을 상위 프록시로 전달합니다.

왜 cntlm인가?

cntlm을 사용 choro, pip3, apt-get하면 명령 줄에서 와 같은 도구를 실행할 수 있습니다.

pip3 install requests
choco install git

cntlm의 주요 장점은 암호 보호입니다.

cntlm을 사용하면 암호 해시를 사용할 수 있습니다.

그래서 NO 평문 암호%HTTP_PROXY%%HTTPS_PROXY%환경 변수

cntlm 설치

sourceforge 에서 최신 cntlm 릴리스를 얻을 수 있습니다.

노트! 사용자 이름 및 도메인

내 사용자 이름은 zezulinsky

내 도메인은 local

내가 사용하는 명령을 실행할 때 zezulinsky@local

명령을 실행할 때 사용자 이름을 입력하십시오.

암호 해시 생성

명령 실행

cntlm -u zezulinsky@local -H

비밀번호 입력 :

Password:

결과적으로 해시 된 암호를 얻게됩니다.

PassLM          AB7D42F42QQQQ407552C4BCA4AEBFB11
PassNT          PE78D847E35FA7FA59710D1231AAAF99
PassNTLMv2      46738B2E607F9093296AA4C319C3A259

생성 된 해시가 유효한지 확인

명령 실행

cntlm -u zezulinsky@local -M http://google.com

비밀번호를 입력하세요

Password:

결과 출력

Config profile  1/4... OK (HTTP code: 301)
----------------------------[ Profile  0 ]------
Auth            NTLMv2
PassNTLMv2      46738B2E607F9093296AA4C319C3A259
------------------------------------------------

노트! PassNTLMv2 해시가 동일한 지 확인하십시오. 결과 해시가 두 명령에 대해 동일합니다.

PassNTLMv2      46738B2E607F9093296AA4C319C3A259

구성 파일 변경

생성 된 해시를 cntlm.ini구성 파일에 배치

C:\Program Files (x86)\Cntlm\cntlm.ini

당신의 cntlm.ini모습은 다음과 같습니다.

Username    zezulinsky
Domain      local
PassLM      AB7D42F42QQQQ407552C4BCA4AEBFB11
PassNT      PE78D847E35FA7FA59710D1231AAAF99
PassNTLMv2  46738B2E607F9093296AA4C319C3A259

Proxy       PROXYSERVER:8080
NoProxy     localhost, 127.0.0.*
Listen      3128

노트! cntlm.ini 끝의 줄 바꿈

It is important to add a newline at the end of the cntlm.ini configuration file

Set your environment variables

HTTPS_PROXY=http://localhost:3128
HTTP_PROXY=http://localhost:3128

Check that your cntlm works

Stop all the processes named cntlm.exe with process explorer

Run the command

cntlm -u zezulinsky@local -H

The output looks like

cygwin warning:
  MS-DOS style path detected: C:\Program Files (x86)\Cntlm\cntlm.ini
  Preferred POSIX equivalent is: /Cntlm/cntlm.ini
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
section: local, Username = 'zezulinsky'
section: local, Domain = 'local'
section: local, PassLM = 'AB7D42F42QQQQ407552C4BCA4AEBFB11'
section: local, PassNT = 'PE78D847E35FA7FA59710D1231AAAF99'
section: local, PassNTLMv2 = '46738B2E607F9093296AA4C319C3A259'
section: local, Proxy = 'PROXYSERVER:8080'
section: local, NoProxy = 'localhost, 10.*, 127.0.0.*
section: local, Listen = '3128'
Default config file opened successfully
cntlm: Proxy listening on 127.0.0.1:3128
Adding no-proxy for: 'localhost'
Adding no-proxy for: '10.*'
Adding no-proxy for: '127.0.0.*'
cntlm: Workstation name used: MYWORKSTATION
cntlm: Using following NTLM hashes: NTLMv2(1) NT(0) LM(0)
cntlm: PID 1234: Cntlm ready, staying in the foreground

Open a new cmd and run a command:

pip3 install requests

You should have requests python package installed

Restart your machine

Congrats, now you have cntlm installed and configured


Just to add , if you are performing a "pip" operation , you might need to add and additional "--proxy=localhost:port_number"

e.g pip install --proxy=localhost:3128 matplotlib

Visit this link to see full details.


Once you generated the file, and changed your password, you can run as below,

cntlm -H

Username will be the same. it will ask for password, give it, then copy the PassNTLMv2, edit the cntlm.ini, then just run the following

cntlm -v

For me just using cntlm -H wasn't generating the right hash, but it does with the command below providing the user name.

If you need to generate a new password hash for cntlm, because you have change it or you've been forced to update it, you can just type the below command and update your cntlm.conf configuration file with the output:

$ cntlm -u test -H
Password: 
PassLM          D2AABAF8828482D5552C4BCA4AEBFB11
PassNT          83AC305A1582F064C469755F04AE5C0A
PassNTLMv2      4B80D9370D353EE006D714E39715A5CB    # Only for user 'test', domain ''

참고URL : https://stackoverflow.com/questions/9181637/how-to-fill-in-proxy-information-in-cntlm-config-file

반응형