Git Product home page Git Product logo

ntlm's Introduction

Overview

This is an implementation of ntlm negotiation message using C++. So, you can use it to pass ntlm authentication in linux platform. (Note: This project can also pass compiling on windows, but I didn't run any test.) Currently, I don't implement the session security part. But you can still use it to pass ntlm authentication(include ntlmv1, ntlm2session, and ntlmv2).

Usage

There are 2 main functions:

string make_type1_msg(string domain, string host, int ntlm_resp_type);
string make_type3_msg(string username, string password, string domain, string host, string msg2_b64_buff, int ntlm_resp_type);

ntlm_resp_type only accepts 3 type values defined in ntlm.h

#define USE_NTLMV1  1
#define USE_NTLM2SESSION   2
#define USE_NTLMV2  3

msg2_b64_buff is the challenge string you obtain from type2 message. For example, the msg2_b64_buff should be 11223344aabbccdd in the following type2 message used in a proxy authentication.

HTTP/1.1 407 Proxy Authentication Required ( Access is denied.)
Via: 1.1 VM-2K3R2
Proxy-Authenticate: Negotiate 11223344aabbccdd
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 0

You need only include ntlm.h in your cpp file.

Compiling

I use openssl library to implement encryption algorithms used by ntlm. So you need download and compile it on your platform. The library included in this repository is a 64-bit static library built on ubuntu 16.04.

Here is an example: If you have test.cpp including main() function, you can compile it using the following commands:

g++ -g -c util.cpp -o util.o -Iinclude 
g++ -g -c ntlm.cpp -o ntlm.o -Iinclude 
g++ -g -c test.cpp -o test.o -Iinclude 
g++ -o test util.o ntlm.o test.o -Llib -lssl -lcrypto -pthread -ldl

License

The MIT License (MIT)

Copyright (c) 2017 dyduyu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ntlm's People

Contributors

gooydu avatar hamstergene avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.