1 2 Previous Next 10 Replies Latest reply: Apr 13, 2012 10:52 AM by mvarandani RSS

    Need .NET API/DLL

    mvarandani

      Hi All,

       

      I am new to EPO and trying to connect the EPO via webAPI but the manual provided on site is based on Python language and I would like to connect my EPO via C#.net coding.

      Specifically i would like to know that how I can update the systems in EPO via WebApi.

       

      So please assist me in the direction or providing links/help mannual in .net aspects.

       

      I am using EPO latest version.

       

      Thanks in Advance!!

       

      Regards

      Mahendra Varandani

        • 1. Re: Need .NET API/DLL
          JoeBidgood

          Sorry, replied to your other message before I saw this one

          I'm not aware of any .net resources  - hopefully some other forum members may be able to help out.

           

          HTH -

           

          Joe

          • 2. Re: Need .NET API/DLL
            mvarandani

            Hi Joe.

             

            Thanks for replying..

             

            So i had installed python on IIS server and I am successfully able to connect the Mcafee EPO via webservice.

             

            but as earlier I stated that  I have to use the webservice for "Importing new devices via external sources"

             

            I am following the Mcafee EPO python webservice guide but it is giving me error;

             

             

            SysProps[0]=00-XX-XX-27-56-XX

            sysProps[1]=00.108.200.02

            dnsName=sysProps[2]:HOSTNAME

            domainName=sysProps[3]:DOMAIN NAME

             

             

            Traceback (most recent call last):  File "C:\PythonApp\addsystem.py", line 20, in     systemId = mc.detectedsystem.add(sourceId,sourceType,sysProps[0],sysProps[1],dnsName=sysPr ops[2],domainName=sysProps[3])  File "C:\PythonApp\mcafee.py", line 454, in __call__    raise emcafee.CommandInvokerError: Error setting parameters for command: detectedsystem.add

             

            Mcafee version:4.6.0

            Python Version :2.7

             

             

            Please let me know what I am exactly missing.

             

            Thanks in advance!!

             

            Regards,

            Mahendra Varandani

            • 3. Re: Need .NET API/DLL
              Tristan

              There's a handy tool (ePO.API.Explorer) that's available from this site that give insite into the contructs and parameters for all the ePO API commands.

               

              https://community.mcafee.com/docs/DOC-2931

               

              From you sample data it looks like your IP address is invalid (but that might be the fact that you copied into your post incorrectly)

               

              -- From API.Explorer

              -- ==================

               

              detectedsystem.add sourceID sourceType MAC IPAddress [IPSubnet] [IPSubnetMask] [dnsName] [OSPlatform] [OSFamily] [OSVersion] [domain][netbiosName] [netbiosComment] [users] [agentGUID] [detectedTime] [externalID]

              Adds a single interface of a Detected System into the list of known Detected Systems. In addition to the source ID and source type,  both a MAC address and an IP address (v4 or v6) must be provided. The combination of source ID and source type, arbitrarily defined by whoever is adding this system, denotes the source of detection for this Detected System.

              Requires permission to create and edit rogue system information.

               

              -- ==================

               

              As for .NET/C# compatibility for the ePO technically it is possible you just have to code it yourself.

               

              The API is basically a URL interface to the ePO database, you could do everything by typing the commands into a browser address bar (or use WGET if your L33T). So in theory if you could construct the URL in C# you can then just submit it as a web request to the ePO server.

              • 4. Re: Need .NET API/DLL
                mvarandani

                Hi Tristan,

                 

                Even I was trying the same issue so right now I am stucked on some other place.

                You are right it was a just a syntactical mistake I was doing.

                 

                By the way right now I am trying to execute the same command but it is giving me the error on last line of code:

                 

                 

                I am trying this example:

                import mcafee, sys

                mc = mcafee.client('localhost','8443','ga','ga','https','json')

                file = open('C:/path/to/myfile.txt', 'r')

                for line in file:

                #determine the ID of the group to add it to

                groups = mc.system.findGroups('Lost&Found')

                groupId = -1

                for group in groups:

                if group['groupPath'] == 'My Organization\\Lost&Found']:

                groupId = group['groupId']

                if groupId == -1:

                error = 'Error finding the specified group.'

                sys.exit(error)

                #now that we have the group id, pull in the systems from file

                sourceId = "12"

                sourceType = "CLI"

                file = open('C:/path/to/systemsToAdd.txt', 'r')

                for line in file:

                sysProps = line.split(',')

                systemId = mc.detectedsystem.add(sourceId,sourceType,sysProps[0],sysProps[1],

                dnsName=sysProps[2],domainName=sysProps[4])

                detectedsystem.addToTree(systemId,groupId)

                 

                and the above bold line is giving me the below error

                 

                 

                Traceback (most recent call last):  File "C:\PythonApp\addsystem.py", line 24, in     mc.detectedsystem.addToTree(systemId,groupId)  File "C:\PythonApp\mcafee.py", line 448, in __call__    return self.invoker.invoke(self.prefix + '.' + self.name, argmap)  File "C:\PythonApp\mcafee.py", line 272, in invoke    if arg[:8] == 'file:///':TypeError: 'int' object is not subscriptable

                 

                 

                ==================

                 

                @ .Net:

                 

                Wow,that great if I can use it by only constructing the URL only.

                 

                1) So do that URL would be submitted via Curl?? as wget is a unix command or so?

                2) Will you please refer me or give me a single complete URL format for the same and what guide will list the URL's type and syntax,

                 

                Thanks for support!!

                 

                Regards

                mahendra

                • 5. Re: Need .NET API/DLL
                  mvarandani

                  Hi Tristan,

                   

                  I got it ..web URL is working perfectly..

                   

                  But i had few concerns:

                   

                  1) Are these system which are added will be in the rouge only ??? we cannot add them in direct system tree ?

                  2) And when we use the URL then we have to give a username and password?So what are the addition in parameter I have to do in remote login.

                   

                  Thanks again for your help...

                  • 6. Re: Need .NET API/DLL
                    Tristan

                    I would guess the line

                     

                    mc.detectedsystem.add(sourceId,sourceType,sysProps[0],sysProps[1],dnsName=sysPro ps[2],domainName=sysProps[4])

                     

                    is at fault. What ever it's returning as a resulting value to systemid is not a valid variable for the addToTree command.

                     

                     

                    The explorer tool will also help you build the URLs and allow you to test/submit to your epo server and i think Curl will work as well

                     

                    A rough example of a constructed URL to do what your attempting would be something like :-

                     

                    https://eposerver:8443/remote/detectedsystem.addToTree?names=testpc1.domain.com& branchNodeID=-1

                    • 7. Re: Need .NET API/DLL
                      mvarandani

                      Tristian,

                       

                      As i said URL's are working fine..but whenever I am submitting the URL manually it will popup a login box so how coding will fire the URL ??

                       

                      I will go unsuccess because URL would not contain any username/pass authentication data to process...

                       

                      Please suggest??

                       

                      Thanks for your help..

                      • 8. Re: Need .NET API/DLL
                        Tristan

                        From the web API script guide provided by McAfee it shows how to pass username and passwords using WGET

                         

                        wget -q -O - --no-check-certificate --user=ga --password=ga "https://localhost:8443/remote/core.help"

                         

                        I assume that CURL has the same functionality

                        • 9. Re: Need .NET API/DLL
                          Tristan

                          To do it in a browser appears to be a little tricky

                           

                          http://support.microsoft.com/kb/834489

                           

                          It would appear that Microsoft has disabled the sending of usernames and passwords in http and https URLs since IE6

                           

                          e.g https://username:password@localhost:8443/remote/core.help

                           

                          However there is a way to disable it in the MS KB entry but it's a bit messy in my opinion...shame.

                          1 2 Previous Next