Jump to content

Help for a small login script


 Share

Recommended Posts

hello!

can someone show me an example of how login in background to my web.

and after logged in, page automatic will redirect to profile page THEN search for this line.

<div class="um um-profile um-viewing um-400 um-role-um_client ">

or

<div class="um um-profile um-viewing um-400 um-role-um_admin ">

Its to a add or remove permissions online

Im using this because i think is easier than databases, hehe.

Its a wordpress page.

Link to comment
Share on other sites

  • Developers

  

21 minutes ago, rednaxela said:

Im using this because i think is easier than databases, hehe.

Agree...  A hammer is soo much easier that a screwdriver at times. 🤐

... but you seriously need to provide much more information for us to be able to help. 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

8 hours ago, Jos said:

  

Agree...  A hammer is soo much easier that a screwdriver at times. 🤐

... but you seriously need to provide much more information for us to be able to help. 

Im near to complete it, i have done the login and redirection to profile and get the source code with _INetGetSource()

 

Do you know how can i filter all HTML to only search if exist this line:

<div class="um um-profile um-viewing um-400 um-role-um_client ">

Or get some key word of there not necessary all line.

Edited by rednaxela
Link to comment
Share on other sites

  • Developers
8 hours ago, rednaxela said:

you seriously need to provide much more information for us to be able to help. 

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

5 hours ago, Jos said:

 

1. i use _INetGetSource()

and get the source code of the page. ( This is just a small area because is huge this html 700 lines)

</div>
                <div data-elementor-type="wp-page" data-elementor-id="402" class="elementor elementor-402" data-elementor-settings="[]">
                            <div class="elementor-section-wrap">
                            <section class="elementor-section elementor-top-section elementor-element elementor-element-424a0b0a elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="424a0b0a" data-element_type="section">
                        <div class="elementor-container elementor-column-gap-default">
                    <div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2d17b90c" data-id="2d17b90c" data-element_type="column">
            <div class="elementor-widget-wrap elementor-element-populated">
                                <div class="elementor-element elementor-element-cf0af6e elementor-widget elementor-widget-spacer" data-id="cf0af6e" data-element_type="widget" data-widget_type="spacer.default">
                <div class="elementor-widget-container">
                    <div class="elementor-spacer">
            <div class="elementor-spacer-inner"></div>
        </div>
                </div>
                </div>
                <div class="elementor-element elementor-element-c0d1598 elementor-widget elementor-widget-shortcode" data-id="c0d1598" data-element_type="widget" data-widget_type="shortcode.default">
                <div class="elementor-widget-container">
                    <div class="elementor-shortcode">
<div class="um um-profile um-viewing um-400 um-role-um_sabot ">

    <div class="um-form" data-mode="profile">

        
        <div class="um-cover "
             data-user_id="2" data-ratio="2.7:1">

            <div style="display: none !important;"><div  id="um_field_400_cover_photo" class="um-field um-field-image  um-field-cover_photo um-field-image um-field-type_image" data-key="cover_photo" data-mode="profile" data-upload-label="Upload"><input type="hidden" name="cover_photo-400" id="cover_photo-400" value="" /><div class="um-field-label"><div class="um-field-label-icon"><i class="um-faicon-picture-o" aria-label="Change your cover photo"></i></div><label for="cover_photo-400">Change your cover photo</label><div class="um-clear"></div></div><div class="um-field-area" style="text-align: center;"><div class="um-single-image-preview crop" data-crop="cover" data-key="cover_photo">
                                <a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>
                                <img src="" alt="" />
                            <div class="um-clear"></div></div><a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="large" data-modal-copy="1" class="um-button um-btn-auto-width">Upload</a></div><div class="um-modal-hidden-content"><div class="um-modal-header"> Change your cover photo</div><div class="um-modal-body"><div class="um-single-image-preview crop"  data-crop="cover" data-ratio="2.7" data-min_width="1000" data-min_height="" data-coord=""><a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a><img src="" alt="" /><div class="um-clear"></div></div><div class="um-clear"></div><div class="um-single-image-upload" data-user_id="2" data-nonce="38475bbc92" data-timestamp="1614091242" data-icon="um-faicon-picture-o" data-set_id="400" data-set_mode="profile" data-type="image" data-key="cover_photo" data-max_size="999999999" data-max_size_error="This image is too large!" data-min_size_error="This image is too small!" data-extension_error="Sorry this is not a valid image."  data-allowed_types="gif,jpg,jpeg,png" data-upload_text="Upload profile cover here&lt;small class=&quot;um-max-filesize&quot;&gt;( max: &lt;span&gt;953.7MB&lt;/span&gt; )&lt;/small&gt;" data-max_files_error="You can only upload one image" data-upload_help_text="">Upload</div><div class="um-modal-footer">
                                    <div class="um-modal-right">
                                        <a href="javascript:void(0);" class="um-modal-btn um-finish-upload image disabled" data-key="cover_photo" data-change="Change photo" data-processing="Processing..."> Apply</a>
                                        <a href="javascript:void(0);" class="um-modal-btn alt" data-action="um_remove_modal"> Cancel</a>
                                    </div>
                                    <div class="um-clear"></div>
                                </div></div></div></div></div>
            <div class="um-cover-e" data-ratio="2.7:1">

                
            </div>

2. Then i want autoit filter all source code to search if this line exist (this line is in the example above)

<div class="um um-profile um-viewing um-400 um-role-um_client ">

return a true or false

Link to comment
Share on other sites

3 hours ago, Jos said:

Did you try StringInstr() ? 

    $source = _IEBodyReadHTML($oIE)

    If StringRegExp($source, '<div class="um um-profile um-viewing um-400 um-role-um_client ">',1) Then
        ConsoleWrite('found')
        _IEQuit($oIE)
    Else
        ConsoleWrite('not found')
        _IEQuit($oIE)
    EndIf

all what i have

Link to comment
Share on other sites

  • Developers

So again ....try using StringInstr()! ;)

...or post a reproducer script so we can test the issue.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

19 hours ago, Jos said:

So again ....try using StringInstr()! ;)

new plan

HTML SECTION

<script id='elementor-frontend-js-before'>
var elementorFrontendConfig = {"environmentMode":{"edit":false,"wpPreview":false,"isScriptDebug":false,"isImprovedAssetsLoading":false},"i18n":{"shareOnFacebook":"Share on Facebook","shareOnTwitter":"Share on Twitter","pinIt":"Pin it","download":"Download","downloadImage":"Download image","fullscreen":"Fullscreen","zoom":"Zoom","share":"Share","playVideo":"Play Video","previous":"Previous","next":"Next","close":"Close"},"is_rtl":false,"breakpoints":{"xs":0,"sm":480,"md":768,"lg":1025,"xl":1440,"xxl":1600},"version":"3.1.1","is_static":false,"experimentalFeatures":{"e_dom_optimization":true,"a11y_improvements":true,"landing-pages":true},"urls":{"assets":"https:\/\/testinggggggg.cloudaccess.host\/wp-content\/plugins\/elementor\/assets\/"},"settings":{"page":[],"editorPreferences":[]},"kit":{"global_image_lightbox":"yes","lightbox_enable_counter":"yes","lightbox_enable_fullscreen":"yes","lightbox_enable_zoom":"yes","lightbox_enable_share":"yes","lightbox_title_src":"title","lightbox_description_src":"description"},"post":{"id":9,"title":"swklafs%20nfvkslja%20%7C%20Your%20WordPress%21%20Site%20hosted%20with%20CloudAccess.net","excerpt":"","featuredImage":false},"user":{"roles":["um_client"]}};
</script>

i wanna seach inside there if can find the word => um_client OR um_admin OR um_free

This section in the html  can change depending how many roles do you have

"user":{"roles":["um_client"]}

to example this:

"user":{"roles":["um_client","um_admin","um_free"]}

 

Autoit

#include <IE.au3>
#include<array.au3>

Call("verify")

Func verify()

    Global $oIE = _IECreate ("https://testinggggggg.cloudaccess.host/login")
    Local $username = _IEGetObjByName ($oIE,"username-6")
    Local $password = _IEGetObjByName ($oIE,"user_password-6")
    Local $button = _IEGetObjById($oIE,"um-submit-btn")
    _IEFormElementSetValue ($username, "rojo")
    _IEFormElementSetValue ($password, "0svgPcKg0M6aMJms94&sr5fb")
    _IEAction ($button, "click")
    _IELoadWait($oIE)
    ConsoleWrite(_IEBodyReadHTML($oIE))

    Local $role = _IEGetObjById($oIE,"elementor-frontend-js-before")


;~  $role = '<div class="um um-profile um-viewing um-7 um-role-um_client ">'
;~  If StringInStr(_IEBodyReadText($oIE), $role) Then
;~      ConsoleWrite('found')
;~      _IEQuit($oIE)
;~  Else
;~      ConsoleWrite('not found')
;~      _IEQuit($oIE)
;~  EndIf

    _IEQuit($oIE)

EndFunc

 

Link to comment
Share on other sites

I imagine someone will come up with a regex to tackle this, but I thought I would throw this solution out there since it's a JSON string --

#include <JSON.au3> ; https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn

$sJSON = '{"environmentMode":{"edit":false,"wpPreview":false,"isScriptDebug":false,"isImprovedAssetsLoading":false},"i18n":{"shareOnFacebook":"Share on Facebook","shareOnTwitter":"Share on Twitter","pinIt":"Pin it","download":"Download","downloadImage":"Download image","fullscreen":"Fullscreen","zoom":"Zoom","share":"Share","playVideo":"Play Video","previous":"Previous","next":"Next","close":"Close"},"is_rtl":false,"breakpoints":{"xs":0,"sm":480,"md":768,"lg":1025,"xl":1440,"xxl":1600},"version":"3.1.1","is_static":false,"experimentalFeatures":{"e_dom_optimization":true,"a11y_improvements":true,"landing-pages":true},"urls":{"assets":"https:\/\/testinggggggg.cloudaccess.host\/wp-content\/plugins\/elementor\/assets\/"},"settings":{"page":[],"editorPreferences":[]},"kit":{"global_image_lightbox":"yes","lightbox_enable_counter":"yes","lightbox_enable_fullscreen":"yes","lightbox_enable_zoom":"yes","lightbox_enable_share":"yes","lightbox_title_src":"title","lightbox_description_src":"description"},"post":{"id":9,"title":"swklafs%20nfvkslja%20%7C%20Your%20WordPress%21%20Site%20hosted%20with%20CloudAccess.net","excerpt":"","featuredImage":false},"user":{"roles":["um_client"]}}'
json_dump($sJSON)

 

Link to comment
Share on other sites

49 minutes ago, Danp2 said:

I imagine someone will come up with a regex to tackle this, but I thought I would throw this solution out there since it's a JSON string --

#include <JSON.au3> ; https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn

$sJSON = '{"environmentMode":{"edit":false,"wpPreview":false,"isScriptDebug":false,"isImprovedAssetsLoading":false},"i18n":{"shareOnFacebook":"Share on Facebook","shareOnTwitter":"Share on Twitter","pinIt":"Pin it","download":"Download","downloadImage":"Download image","fullscreen":"Fullscreen","zoom":"Zoom","share":"Share","playVideo":"Play Video","previous":"Previous","next":"Next","close":"Close"},"is_rtl":false,"breakpoints":{"xs":0,"sm":480,"md":768,"lg":1025,"xl":1440,"xxl":1600},"version":"3.1.1","is_static":false,"experimentalFeatures":{"e_dom_optimization":true,"a11y_improvements":true,"landing-pages":true},"urls":{"assets":"https:\/\/testinggggggg.cloudaccess.host\/wp-content\/plugins\/elementor\/assets\/"},"settings":{"page":[],"editorPreferences":[]},"kit":{"global_image_lightbox":"yes","lightbox_enable_counter":"yes","lightbox_enable_fullscreen":"yes","lightbox_enable_zoom":"yes","lightbox_enable_share":"yes","lightbox_title_src":"title","lightbox_description_src":"description"},"post":{"id":9,"title":"swklafs%20nfvkslja%20%7C%20Your%20WordPress%21%20Site%20hosted%20with%20CloudAccess.net","excerpt":"","featuredImage":false},"user":{"roles":["um_client"]}}'
json_dump($sJSON)

 

What is the solution? 

Link to comment
Share on other sites

Here's a modified example --

#include <JSON.au3> ; https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn
#include <Array.au3>

$sJSON = '{"environmentMode":{"edit":false,"wpPreview":false,"isScriptDebug":false,"isImprovedAssetsLoading":false},"i18n":{"shareOnFacebook":"Share on Facebook","shareOnTwitter":"Share on Twitter","pinIt":"Pin it","download":"Download","downloadImage":"Download image","fullscreen":"Fullscreen","zoom":"Zoom","share":"Share","playVideo":"Play Video","previous":"Previous","next":"Next","close":"Close"},"is_rtl":false,"breakpoints":{"xs":0,"sm":480,"md":768,"lg":1025,"xl":1440,"xxl":1600},"version":"3.1.1","is_static":false,"experimentalFeatures":{"e_dom_optimization":true,"a11y_improvements":true,"landing-pages":true},"urls":{"assets":"https:\/\/testinggggggg.cloudaccess.host\/wp-content\/plugins\/elementor\/assets\/"},"settings":{"page":[],"editorPreferences":[]},"kit":{"global_image_lightbox":"yes","lightbox_enable_counter":"yes","lightbox_enable_fullscreen":"yes","lightbox_enable_zoom":"yes","lightbox_enable_share":"yes","lightbox_title_src":"title","lightbox_description_src":"description"},"post":{"id":9,"title":"swklafs%20nfvkslja%20%7C%20Your%20WordPress%21%20Site%20hosted%20with%20CloudAccess.net","excerpt":"","featuredImage":false},"user":{"roles":["um_client"]}}'
;json_dump($sJSON)

$oJSON = Json_Decode($sJSON)
$aUser = Json_Get($oJSON, ".user.roles")
_ArrayDisplay($aUser)

 

Link to comment
Share on other sites

3 hours ago, Danp2 said:

Here's a modified example --

#include <JSON.au3> ; https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn
#include <Array.au3>

$sJSON = '{"environmentMode":{"edit":false,"wpPreview":false,"isScriptDebug":false,"isImprovedAssetsLoading":false},"i18n":{"shareOnFacebook":"Share on Facebook","shareOnTwitter":"Share on Twitter","pinIt":"Pin it","download":"Download","downloadImage":"Download image","fullscreen":"Fullscreen","zoom":"Zoom","share":"Share","playVideo":"Play Video","previous":"Previous","next":"Next","close":"Close"},"is_rtl":false,"breakpoints":{"xs":0,"sm":480,"md":768,"lg":1025,"xl":1440,"xxl":1600},"version":"3.1.1","is_static":false,"experimentalFeatures":{"e_dom_optimization":true,"a11y_improvements":true,"landing-pages":true},"urls":{"assets":"https:\/\/testinggggggg.cloudaccess.host\/wp-content\/plugins\/elementor\/assets\/"},"settings":{"page":[],"editorPreferences":[]},"kit":{"global_image_lightbox":"yes","lightbox_enable_counter":"yes","lightbox_enable_fullscreen":"yes","lightbox_enable_zoom":"yes","lightbox_enable_share":"yes","lightbox_title_src":"title","lightbox_description_src":"description"},"post":{"id":9,"title":"swklafs%20nfvkslja%20%7C%20Your%20WordPress%21%20Site%20hosted%20with%20CloudAccess.net","excerpt":"","featuredImage":false},"user":{"roles":["um_client"]}}'
;json_dump($sJSON)

$oJSON = Json_Decode($sJSON)
$aUser = Json_Get($oJSON, ".user.roles")
_ArrayDisplay($aUser)

 

I don't get it xD

What return? Xd

 

Link to comment
Share on other sites

  • Developers

It is unbelievable that nobody suggested using StringInstr() before! 

...oh wait ..... I did :) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...