Jump to content
UBot Underground

Recommended Posts

I have a working test client software using a client DLL in C#.

When I try to implement it in the Ubot Plugins Framework, the external DLL its not been loaded.

ANy ideas about this? Where should I put the externals DLL so they can be loaded?

 

Thanks.

Link to post
Share on other sites

You can either use Aymens way to include it ..(better solution).
 

Or you can use ILmerge for it.. It worked fine for me :)

I have built a plugin using ilmerge, have no problem so far !

  • Like 1
Link to post
Share on other sites

I'm finishing one now ... :) Works great ... And making some Blogger API tests.

At the end, I think that UBot will end up been an API framework integrator, and scrapper+spinner.

 

Why we have to navigate to a POST page if the site offers an API?

Nice one the plugins addition, that open the pandora box!!!

Link to post
Share on other sites

"At the end, I think that UBot will end up been an API framework integrator, and scrapper+spinner."

Yes, I think there is a severe risk for that. I wonder if the Ubot staff is fully aware of how fragmented the platform is about to become...  Pity...  (but of course this might be what they are aiming at)

  • Like 1
Link to post
Share on other sites

When you right-click and select RUN NODE from the context menu, both in Code/Node View, as well as clicking the RUN top button of the UBS menu while in Code View, the script will run properly, but many times may hang (won't stop when finished).

The only way you can be sure your bot will stop when finished is to click the RUN button (top menu) while in Node View.

 

Is this what you wanted to know?

Link to post
Share on other sites
  • 3 months later...

well you need to embed the dll with your ubot plugin project , this is a little bit advanced usage !

Aymen, would you be so kind and link to an example that I could follow?

 

Till today I had no problems using ilMerge, but it just won't merge DLLs with the project I'm currently working on (error: "Unresolved assembly reference not allowed: PresentationFramework").

 

I've tried to implement this approach, but it seems it doesn't embed the DLLs (I think there is something wrong with code snippet).

Link to post
Share on other sites

Aymen, would you be so kind and link to an example that I could follow?

 

Till today I had no problems using ilMerge, but it just won't merge DLLs with the project I'm currently working on (error: "Unresolved assembly reference not allowed: PresentationFramework").

 

I've tried to implement this approach, but it seems it doesn't embed the DLLs (I think there is something wrong with code snippet).

 

first of all add the dll as a resource then change Build action to embedded resource , now the complicated part

 

add something like this in your class

static NameOfStartupClassHere()   //this is the class constractor
    {
        AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Resolver);
    }

    static System.Reflection.Assembly Resolver(object sender, ResolveEventArgs args)
    {
     try
                    {
                        tmp = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dll_name_here.dll";
                        if (!File.Exists(tmp))
                        {
                            File.WriteAllBytes(tmp, Resources.dll_name_in_ressource);
                        }
                    }
                    catch (Exception z)
                    {
                    }
return Assembly.LoadFile(tmp);
    }
  • Like 1
Link to post
Share on other sites

Thanks for helping, I appreciate it.

 

 

first of all add the dll as a resource then change Build action to embedded resource , now the complicated part

I've already done that part, but I have a problem with your snippet.

 

Particularly with this part:

 

 

File.WriteAllBytes(tmp, Resources.dll_name_in_ressource);

 

I guess I should change "Resources.dll_name_in_ressource" and load DLL as Byte Stream?

 

I'm also not sure what's the best place for this part:

 

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Resolver);

Could you please tell me?

 

Thanks again.

Link to post
Share on other sites

Thanks for helping, I appreciate it.

 

I've already done that part, but I have a problem with your snippet.

 

Particularly with this part:

 

 

 

I guess I should change "Resources.dll_name_in_ressource" and load DLL as Byte Stream?

 

I'm also not sure what's the best place for this part:

 

Could you please tell me?

 

Thanks again.

 

yes change Resources.dll_name_in_ressource with the name of your ressource

 

and as i said this code

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Resolver);

should be added in the class constractor

Link to post
Share on other sites

Thanks again Aymen for help, I'm getting closer but still have a small problem.

 

I've added "AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Resolver);" to the class constructor, and it doesn't seem to get executed.

 

For testing purposes I have moved the code that writes DLL to folder"....AppData\Roaming\*.dll" from "static Assembly Resolver" to the class constructor, and the the DLL is read from embedded resources  and written successfully, however, "return Assembly.LoadFile(filename);" doesn't load the assembly (even if file already exists), so I'm not sure what's going on (that's why I wrote that it doesn't seem to get executed).

 

Code that doesn't seem to get executed or load DLL:

static System.Reflection.Assembly Resolver(object sender, ResolveEventArgs args)
        {
            string filename = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\lib.dll";
            return Assembly.LoadFile(filename);
        }

Any idea or suggestion from your side?

Link to post
Share on other sites

Thanks again Aymen for help, I'm getting closer but still have a small problem.

 

I've added "AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Resolver);" to the class constructor, and it doesn't seem to get executed.

 

For testing purposes I have moved the code that writes DLL to folder"....AppData\Roaming\*.dll" from "static Assembly Resolver" to the class constructor, and the the DLL is read from embedded resources  and written successfully, however, "return Assembly.LoadFile(filename);" doesn't load the assembly (even if file already exists), so I'm not sure what's going on (that's why I wrote that it doesn't seem to get executed).

 

Code that doesn't seem to get executed or load DLL:

static System.Reflection.Assembly Resolver(object sender, ResolveEventArgs args)
        {
            string filename = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\lib.dll";
            return Assembly.LoadFile(filename);
        }

Any idea or suggestion from your side?

 

i'm not really sure , should work , maybe you missed something !

Link to post
Share on other sites
  • 2 years later...

Heres a magic solution,I had the same problem,and I don't know C# at all,even ilMerge seems too advanced

 

this will make the .DLL fairly large but it just works without needing to do anything

 

Nuget Install-Package Costura.Fody in your project

 

then when you build,everything is inbuilt into the DLL

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...