[Owasp-o2-platform] TwitterAPI

Dinis Cruz dinis at ddplus.net
Wed Jul 14 23:19:08 EDT 2010


can you use http://tortoisesvn.tigris.org ?

It has a pretty cool 'Submit Patch' feature that creates a file with all the
changes you made (which you can then send me)

I'm not sure I understand you last question (it will probably make more
sense when I see the patch)

Dinis

On Thu, Jul 15, 2010 at 1:09 AM, Steven van der Baan <steven at vdbaan.net>wrote:

> Hi Dinis,
>
> I can send the patch in a couple of ways:
> - i can "just" commit it to the SVN (if i have the rights, ofcourse)
> - Use WinMerge to create a Patch and send you the patch
> - or just send the changed files to you (and let you deal with it :) )
>
> what ever you prefer as owner of the code is fine with me, i'll adjust
> (although the first option is my prefered one).
>
> BTW, do I see correctly that you would prefer that the secretData
> reading/writing is done in the O2TwitterAPI.CS file in stead of the
> TwitterClient.H2. If that's the case i'll rewrite it to the CS file.
>
> Greetings,
> Steven.
>
>
> On 14 July 2010 16:07, dinis cruz <dinis.cruz at owasp.org> wrote:
>
>> The history of that is very similar to a lot of scripts in O2 :)
>>
>> My development rule is that I only create/modify a script when there is
>> active need and use-case for it. And since each new script feeds on the
>> previous ones, given the fast pace of development, the older scrips end-up
>> having a lot of code that could be written in completely different (and
>> usually very simpler) ways.
>>
>> The O2TwitterAPI.cs is a good example since that is one of the first APIs
>> that I wrote in O2 (i.e. when I was able to develop O2 in O2), and there is
>> a quite a lot of that code that it was the first pass at solving a
>> particular problem.
>>
>> In this case (I think if I remember correctly) I actually developed the
>> SecretData API for this TwitterAPI. The reasoning was that I wanted to have
>> a separate location (which eventually should be a safe-data-storage
>> device/system/location) to store passwords and secret data (another example
>> are Amazon S3 access tokens).
>>
>> In that first version of the SecretData api, it was easier to have have
>> separate files for each type of account. Eventually, as I used the
>> SecretData API in other modules, I added support (via extension methods) to
>> easily get the user/pwd pair of a specfic CredentialType. This allows for
>> the consolidation of all (or most) secret details into one file (see
>> SecretData_ExtensionMethods.cs for a list of extension methods)
>>
>> Here is a good example if this in action (from API_BTOpenZone.cs):
>>
>>        public API_BTOpenZone login()
>>         {
>>             return login(@"C:\O2\_USERDATA\BtOpenZone.xml");
>>         }
>>
>>         public API_BTOpenZone login(string fileWithLoginDetails)
>>         {
>>
>>                 .................
>>
>>                 // get the login details
>>                 ICredential credential =
>> fileWithLoginDetails.credential("BtOpenZone");
>>
>>                 if (credential==null)
>>                 {
>>                     "no file with credentials provided, or no credential
>> of type BtOpenZone found".debug();
>>                     credential = ie.askUserForUsernameAndPassword();
>>                 }
>>                 var BTOpenZone_UserName = credential.username();
>>                 var BTOpenZone_Password = credential.password();
>>
>> Btw, when sending the patch, what tool are you going to use?
>>
>> Dinis Cruz
>>
>>
>>
>> On 14 July 2010 13:36, Steven van der Baan <steven at vdbaan.net> wrote:
>>
>>> Hoi Dinis,
>>>
>>> before i submit my patch, just one Question. Why the separate
>>> TwittetAccounts file, couldn't it be a part of the SecretData itself. Was
>>> there a particular reason that you seperated them into multiple files (i
>>> also saw some other files), or can i use the SecretData to store the Twitter
>>> accounts.
>>>
>>> Greetings,
>>> Steven.
>>>
>>>
>>> On 14 July 2010 11:18, Steven van der Baan <steven at vdbaan.net> wrote:
>>>
>>>> Hi Dinis,
>>>>
>>>> i located where i have to put the DLL. It was in some obscure location
>>>> at AppData\Local\Apps\2.0\ and them some weird location names which i would
>>>> not connect to O2. The OnceClick install doesn't use a install directory but
>>>> installs it there. After placing the Newtonsoft.dll there the twitter client
>>>> opened up. I still don't know why it didn't download it to the correct
>>>> directory in the first place, but i'll try to find that out as well.
>>>>
>>>> And now i'm going to try to patch the twitter_client.h2
>>>>
>>>> Greetings,
>>>> Steven.
>>>>
>>>>
>>>>
>>>> On 14 July 2010 02:12, dinis cruz <dinis.cruz at owasp.org> wrote:
>>>>
>>>>> Humm, I just noticed an issue with that API (thanks Colin) If you look
>>>>> at the first line of the *'APIs\Twitter\Twitter Client.h2'* script, it
>>>>> expects a secrets file to be located in
>>>>>
>>>>> *var fileWithCredentials = @"C:\O2\_USERDATA\TwitterAccounts.xml";'*
>>>>>
>>>>>
>>>>> and this secrets file should contain the desired user(s) with the
>>>>> CredentialType to be marked as 'Twitter'
>>>>>
>>>>> *secretData = fileWithCredentials.deserialize<SecretData>();*
>>>>> *usersComboBox.clear();           ** ** ** *
>>>>> *usersComboBox.add_Items(secretData.usernames("Twitter"));*
>>>>>
>>>>>
>>>>> To create this file use the "O2 'Secret Data' Editor" link which you
>>>>> can find in the "Windows Tools" Tab (and yeah the workflow on that tool
>>>>> needs some improvement too :)  )
>>>>>
>>>>> Steven, can you see if you can solve this (i.e. prompting the user for
>>>>> the credentials) and send me a patch :) . If you want a clue on how to do it
>>>>> (and what APIs to use) check out the *API_Blogger.cs* script (line 98
>>>>> more specifically :)  )
>>>>>
>>>>> Have fun
>>>>>
>>>>> Dinis Cruz
>>>>>
>>>>>
>>>>> On 14 July 2010 00:31, Dinis Cruz <dinis at ddplus.net> wrote:
>>>>>
>>>>>> Stick with the web install since I'm about to push a small update on
>>>>>> that twitter API which will help you
>>>>>>
>>>>>> Can you try compiling it using the 'O2 Development Environment' (on
>>>>>> the 'API / Script Development' tab)?
>>>>>>
>>>>>> Meanwhile, I'm going to forward you the details of the O2 testbox at
>>>>>> Amazon EC2 so that you can use to try it (or replicate the problem)
>>>>>>
>>>>>> Dinis
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 14, 2010 at 12:20 AM, Steven van der Baan <
>>>>>> steven at vdbaan.net> wrote:
>>>>>>
>>>>>>> Unfortunately that doesn't compile. Even after a restart or using the
>>>>>>> option. I did place the dll in the install directory (I think it is c:\O2,
>>>>>>> but i didn't see it in the log file). Am thinking of doing a complete
>>>>>>> reinstall and check if that will help (i used the web installer and not the
>>>>>>> MSI).
>>>>>>>
>>>>>>> I'll try to locate the possible differences between the web and MSI
>>>>>>> installer, maybe it has something to do with that.
>>>>>>>
>>>>>>> Greetings,
>>>>>>> Steven
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 14 July 2010 00:56, dinis cruz <dinis.cruz at owasp.org> wrote:
>>>>>>>
>>>>>>>> Actually that file should had been automatically downloaded from the
>>>>>>>> O2 SVN codebase and placed on the O2 install directory (check the O2
>>>>>>>> LogViewer for details)
>>>>>>>>
>>>>>>>> To double check that all is working, can you run this script on the
>>>>>>>> 'O2 Simple Script Editor'?
>>>>>>>>
>>>>>>>> var twitterAPI = new O2TwitterAPI();
>>>>>>>> return twitterAPI;
>>>>>>>>
>>>>>>>> //using O2.XRules.Database.APIs
>>>>>>>> //O2File:O2TwitterAPI.cs
>>>>>>>> //O2Ref:Dimebrain.TweetSharp.dll
>>>>>>>> //O2Ref:Newtonsoft.Json.dll
>>>>>>>>
>>>>>>>> If that compiles OK and returns the O2TwitterAPI object, then all
>>>>>>>> should be good
>>>>>>>>
>>>>>>>> (note you might need to restart O2 or click the option 'current
>>>>>>>> source code' --> 'clear AssembliesCheckedIfExists list' context menu option
>>>>>>>> from the  'O2 Simple Script Editor')
>>>>>>>>
>>>>>>>> Dinis Cruz
>>>>>>>>
>>>>>>>>
>>>>>>>> On 13 July 2010 23:24, Steven van der Baan <steven at vdbaan.net>wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> i'm trying to use the Twitter client but i get the following error:
>>>>>>>>>
>>>>>>>>> ERROR: [CSharp_FastCompiler] Compilation Error:
>>>>>>>>> 0::0::CS0006::Metadata file 'Newtonsoft.Json.dll' could not be found::
>>>>>>>>>
>>>>>>>>> I know that i can place this DLL in my windows system32 directory
>>>>>>>>> to make it work, but i don't like to do that. I rather place those type of
>>>>>>>>> DLL's with the application which is requesting it. Is there a 'default'
>>>>>>>>> location for foreign DLL's or another trick to make the O2Platform load
>>>>>>>>> them.
>>>>>>>>>
>>>>>>>>> Thanks in advance,
>>>>>>>>> Steven.
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Owasp-o2-platform mailing list
>>>>>>>>> Owasp-o2-platform at lists.owasp.org
>>>>>>>>> https://lists.owasp.org/mailman/listinfo/owasp-o2-platform
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Owasp-o2-platform mailing list
>>>>>>> Owasp-o2-platform at lists.owasp.org
>>>>>>> https://lists.owasp.org/mailman/listinfo/owasp-o2-platform
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
> _______________________________________________
> Owasp-o2-platform mailing list
> Owasp-o2-platform at lists.owasp.org
> https://lists.owasp.org/mailman/listinfo/owasp-o2-platform
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.owasp.org/pipermail/owasp-o2-platform/attachments/20100715/d0f742af/attachment.html 


More information about the Owasp-o2-platform mailing list