EasyRecon/Hunt3r

View on GitHub

Showing 134 of 138 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      if(Object.prototype.hasOwnProperty.call(stat.earn_by_month,key)){
        data2.push(stat.earn_by_month[key as keyof typeof stat.earn_by_month])
       } else data2.push(0)
frontend/src/app/admin/bugbountyStat/bugbountyStat.component.ts on lines 220..222

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method build_nuclei_scan_cmd has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_nuclei_scan_cmd(scan, scan_cmd)
    scan_cmd[:cmd] += " --nuclei #{scan.nuclei}"

    unless (scan.custom_templates && !scan.custom_templates.empty?) || scan.all_templates
      scan_cmd[:errors] = 'no_nuclei_templates'
Severity: Minor
Found in backend/app/controllers/scans_controller.rb - About 1 hr to fix

    Method build_recon_scan_cmd has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def build_recon_scan_cmd(scan, scan_cmd)
        scan_cmd[:errors] = 'missing_amass' unless File.exist?(File.join(scan_config_files, 'amass/config.ini'))
    
        scan_cmd = build_recon_scan_leak_cmd(scan_cmd) if scan.leak
        scan_cmd = build_recon_scan_intel_cmd(scan_cmd) if scan.intel
    Severity: Minor
    Found in backend/app/controllers/scans_controller.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method launch_scan has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def launch_scan(cmd, scan, server, base_domain)
        if scan.type_scan == 'recon'
          domain = Domain.find_by(name: scan.domain)
          domain.nil? ? Domain.create(name: scan.domain) : domain.update(updated_at: Time.now)
        end
    Severity: Minor
    Found in backend/app/controllers/scans_controller.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      {
        title: 'Settings',
        icon: 'settings-outline',
        children: [
          {
    Severity: Major
    Found in frontend/src/app/UI/components/nb-menu-service/menu.ts and 1 other location - About 1 hr to fix
    frontend/src/app/UI/components/nb-menu-service/menu.ts on lines 87..109

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      {
        title: 'Bugbounty platform',
        icon: 'cube-outline',
        children: [
          {
    Severity: Major
    Found in frontend/src/app/UI/components/nb-menu-service/menu.ts and 1 other location - About 1 hr to fix
    frontend/src/app/UI/components/nb-menu-service/menu.ts on lines 110..130

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method launch_server has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def launch_server(scan)
        server_infos = {}
    
        unless scan.provider == 'scaleway' || scan.provider == 'aws'
          server_infos[:error] = 'unknown_provider'
    Severity: Minor
    Found in backend/app/controllers/scans_controller.rb - About 1 hr to fix

      Method provider_is_valid? has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def provider_is_valid?(providers_params)
        case providers_params[:name]
        when 'scaleway'
          path = '/root/.config/scw/config.yaml'
          dir = File.dirname(path)
      Severity: Minor
      Found in backend/app/controllers/admin/providers_controller.rb - About 1 hr to fix

        Method launch_server has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def launch_server(scan)
            server_infos = {}
        
            unless scan.provider == 'scaleway' || scan.provider == 'aws'
              server_infos[:error] = 'unknown_provider'
        Severity: Minor
        Found in backend/app/controllers/scans_controller.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        export const defaultSettings: any = {
          
          forms: {
            login: {
              redirectDelay: 0, // delay before redirect after a successful login, while success message is shown to the user
        Severity: Major
        Found in frontend/src/app/acl/acl.module.ts and 1 other location - About 1 hr to fix
        frontend/src/app/auth/auth.module.ts on lines 21..34

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 66.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        export const defaultSettings: any = {
          
          forms: {
            login: {
              redirectDelay: 0, // delay before redirect after a successful login, while success message is shown to the user
        Severity: Major
        Found in frontend/src/app/auth/auth.module.ts and 1 other location - About 1 hr to fix
        frontend/src/app/acl/acl.module.ts on lines 21..34

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 66.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method generate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def generate
            platform = Platform.find_by_name(params[:name])
            unless allowed_platform?(platform)
              return render status: 422, json: { message: I18n.t('errors.controllers.admin.invoices.unsupported_platform') }
            end
        Severity: Minor
        Found in backend/app/controllers/admin/invoice_controller.rb - About 1 hr to fix

          Method parse_scopes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.parse_scopes(scopes, slug, platform)
              program = Program.find_by(slug: slug)
              scopes.each do |scope|
                next unless scope['attributes']['eligible_for_submission']
          
          
          Severity: Minor
          Found in backend/lib/platforms/hackerone.rb - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            getPrograms(platform:any,search:any): Observable<ProgramsData> {
              return this.httpService.get<ProgramsData>('/programs?name='+platform+'&program='+search)
            }
          Severity: Major
          Found in frontend/src/app/core/programs/programs.service.ts and 1 other location - About 1 hr to fix
          frontend/src/app/core/bugbountyPlatform/bugbountyPlatform.service.ts on lines 43..45

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 63.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            delete<T>(url:string): Observable<T>  {
              return this.http
                .delete<T>(
                  this.baseurl + url,
                  this.httpOptions
          Severity: Major
          Found in frontend/src/app/shared/http.service.ts and 1 other location - About 1 hr to fix
          frontend/src/app/shared/http.service.ts on lines 32..39

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 63.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (config) {
            config.set({
              basePath: '',
              frameworks: ['jasmine', '@angular-devkit/build-angular'],
              plugins: [
          Severity: Minor
          Found in frontend/karma.conf.js - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              get<T>(url:string): Observable<T>  {
                return this.http
                  .get<T>(
                    this.baseurl + url,
                    this.httpOptions
            Severity: Major
            Found in frontend/src/app/shared/http.service.ts and 1 other location - About 1 hr to fix
            frontend/src/app/shared/http.service.ts on lines 75..82

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              getProgram(platform:any,program:any): Observable<BugBountyPlatformStatsResponse> {
                return this.httpService.get<BugBountyPlatformStatsResponse>('/programs?name='+platform+'&program='+program)
              }
            frontend/src/app/core/programs/programs.service.ts on lines 15..17

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                        if(Math.floor(Date.now() / 1000) > this.user.exp){
                          localStorage.clear();
                          this.router.navigateByUrl('/auth/login');
                        }
            frontend/src/app/shared/auth-guard.service.ts on lines 29..32

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                                if(Math.floor(Date.now() / 1000) > this.user.exp){
                                  localStorage.clear();
                                  this.router.navigateByUrl('/auth/login');
                                }
            Severity: Major
            Found in frontend/src/app/shared/auth-guard.service.ts and 1 other location - About 1 hr to fix
            frontend/src/app/UI/components/nb-sidebar-toggle/nb-sidebar-toggle.component.ts on lines 62..65

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language